Problem: atomic intrinsics unreliable on PPC64 and RISC-V

Solution: prefer CXX11 atomics if they are available to compiler
intrinsics.
test_hwm_pubsub fails 50% of the times on PPC64 and RISC-V with an
apparent memory corruption of messages sent by the application thread
to the I/O thread when using compiler intrinsics.
Switching to CXX11 atomics makes the test reliable again. The
standard API should be preferred anyway, if available.
This commit is contained in:
Luca Boccassi 2019-01-19 21:42:54 +00:00
parent 8040e28b26
commit bfb4a868fc
2 changed files with 4 additions and 4 deletions

View File

@ -35,11 +35,11 @@
#if defined ZMQ_FORCE_MUTEXES
#define ZMQ_ATOMIC_COUNTER_MUTEX
#elif defined ZMQ_HAVE_ATOMIC_INTRINSICS
#define ZMQ_ATOMIC_COUNTER_INTRINSIC
#elif (defined __cplusplus && __cplusplus >= 201103L) \
|| (defined _MSC_VER && _MSC_VER >= 1900)
#define ZMQ_ATOMIC_COUNTER_CXX11
#elif defined ZMQ_HAVE_ATOMIC_INTRINSICS
#define ZMQ_ATOMIC_COUNTER_INTRINSIC
#elif (defined __i386__ || defined __x86_64__) && defined __GNUC__
#define ZMQ_ATOMIC_COUNTER_X86
#elif defined __ARM_ARCH_7A__ && defined __GNUC__

View File

@ -34,11 +34,11 @@
#if defined ZMQ_FORCE_MUTEXES
#define ZMQ_ATOMIC_PTR_MUTEX
#elif defined ZMQ_HAVE_ATOMIC_INTRINSICS
#define ZMQ_ATOMIC_PTR_INTRINSIC
#elif (defined __cplusplus && __cplusplus >= 201103L) \
|| (defined _MSC_VER && _MSC_VER >= 1900)
#define ZMQ_ATOMIC_PTR_CXX11
#elif defined ZMQ_HAVE_ATOMIC_INTRINSICS
#define ZMQ_ATOMIC_PTR_INTRINSIC
#elif (defined __i386__ || defined __x86_64__) && defined __GNUC__
#define ZMQ_ATOMIC_PTR_X86
#elif defined __ARM_ARCH_7A__ && defined __GNUC__