Skip to content
Snippets Groups Projects
Commit ecb907e0 authored by Joshua Colp's avatar Joshua Colp
Browse files

Use OSAtomicAdd instead of OSAtomicDecrement to decrement the value by 1.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@40303 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 4879edbc
Branches
Tags
No related merge requests found
...@@ -789,12 +789,12 @@ AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p), ...@@ -789,12 +789,12 @@ AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p),
#elif defined(HAVE_OSX_ATOMICS) && (SIZEOF_INT == 4) #elif defined(HAVE_OSX_ATOMICS) && (SIZEOF_INT == 4)
AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p), AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p),
{ {
return OSAtomicDecrement32((int32_t *) p) == 0; return OSAtomicAdd32( -1, (int32_t *) p) == 0;
}) })
#elif defined(HAVE_OSX_ATOMICS) && (SIZEOF_INT == 8) #elif defined(HAVE_OSX_ATOMICS) && (SIZEOF_INT == 8)
AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p), AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p),
{ {
return OSAtomicDecrement64((int64_t *) p) == 0; return OSAtomicAdd64( -1, (int64_t *) p) == 0;
#else #else
AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p), AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p),
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment