From: Ivan Maidanski Date: Tue, 19 Dec 2017 08:46:06 +0000 (+0300) Subject: Allow to select almost-non-blocking stack implementation explicitly X-Git-Tag: v7.6.2~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=339d403ce9175989b1cff8a3cf633b26626b77cd;p=libatomic_ops Allow to select almost-non-blocking stack implementation explicitly 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). --- diff --git a/src/atomic_ops_stack.h b/src/atomic_ops_stack.h index 32bef7c..5c21268 100644 --- a/src/atomic_ops_stack.h +++ b/src/atomic_ops_stack.h @@ -31,9 +31,12 @@ #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 */