3 --- include
/asterisk
/lock
.h
.orig
2011-01-31 07:52:48.000000000 +0000
4 +++ include
/asterisk
/lock
.h
5 @@
-569,7 +569,7 @@
static void __attribute__((destructor
))
7 #define gethostbyname __gethostbyname__is__not__reentrant__use__ast_gethostbyname__instead__
10 +#if !defined(__linux__) && !defined(__DragonFly__)
11 #define pthread_create __use_ast_pthread_create_instead__
14 @@
-591,6 +591,10 @@
int ast_atomic_fetchadd_int_slow(volatil
15 #include "libkern/OSAtomic.h"
18 +#if defined(HAVE_SYS_ATOMIC_H)
19 +#include <sys/atomic.h>
22 /*! \brief Atomically add v to *p and return * the previous value of *p.
23 * This can be used to handle reference counts, and the return value
24 * can be used to generate unique identifiers.
25 @@ -610,6 +614,12 @@ AST_INLINE_API(int ast_atomic_fetchadd_i
26 AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v),
28 return OSAtomicAdd64(v, (int64_t *) p) - v;
30 +#elif defined(HAVE_SYS_ATOMIC_H)
31 +AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v),
33 + return atomic_add_int_nv((unsigned int *)p, v) - v;
35 #elif defined (__i386__) || defined(__x86_64__)
37 AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v),
38 @@ -656,6 +666,12 @@ AST_INLINE_API(int ast_atomic_dec_and_te
39 AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p),
41 return OSAtomicAdd64( -1, (int64_t *) p) == 0;
43 +#elif defined(HAVE_SYS_ATOMIC_H)
44 +AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p),
46 + return atomic_dec_uint_nv((unsigned int *)p) == 0;
49 AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p),