diff --git a/src/BlocksRuntime/runtime.c b/src/BlocksRuntime/runtime.c index 4b7d4bfa2..0a711b310 100644 --- a/src/BlocksRuntime/runtime.c +++ b/src/BlocksRuntime/runtime.c @@ -8,10 +8,11 @@ // #include "Block_private.h" +#include +#include #include #include #include -#include #if HAVE_OBJC #define __USE_GNU #include @@ -32,9 +33,10 @@ #define __has_builtin(builtin) 0 #endif -#if __has_builtin(__sync_bool_compare_and_swap) +#if __has_builtin(__atomic_compare_exchange_n) #define OSAtomicCompareAndSwapInt(_Old, _New, _Ptr) \ - __sync_bool_compare_and_swap(_Ptr, _Old, _New) + __atomic_compare_exchange_n(_Ptr, &_Old, _New, false, __ATOMIC_RELAXED, \ + __ATOMIC_RELAXED) #else #define _CRT_SECURE_NO_WARNINGS 1 #include