Allow to select almost-non-blocking stack implementation explicitly
authorIvan Maidanski <ivmai@mail.ru>
Tue, 19 Dec 2017 08:46:06 +0000 (11:46 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 22 Dec 2017 07:46:14 +0000 (10:46 +0300)
This could be used e.g. if built-in double-word CAS has some bug.

* src/atomic_ops_stack.h (AO_STACK_IS_LOCK_FREE): Do not define if
AO_USE_ALMOST_LOCK_FREE is explicitly defined (outside).

src/atomic_ops_stack.h

index 32bef7c..5c21268 100644 (file)
 
 #include "atomic_ops.h"
 
-#if !defined(AO_HAVE_compare_double_and_swap_double) \
-    && !defined(AO_HAVE_compare_double_and_swap) \
-    && defined(AO_HAVE_compare_and_swap)
+#ifdef AO_USE_ALMOST_LOCK_FREE
+  /* Use the almost-non-blocking implementation regardless of the       */
+  /* double-word CAS availability.                                      */
+#elif !defined(AO_HAVE_compare_double_and_swap_double) \
+      && !defined(AO_HAVE_compare_double_and_swap) \
+      && defined(AO_HAVE_compare_and_swap)
 # define AO_USE_ALMOST_LOCK_FREE
 #else
   /* If we have no compare-and-swap operation defined, we assume        */