Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / comms / asterisk10 / patches / patch-include_asterisk_lock.h
blob361225873e0a533c8fbd2e5a0b286d581aeddfa4
1 $NetBSD$
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__
9 -#ifndef __linux__
10 +#if !defined(__linux__) && !defined(__DragonFly__)
11 #define pthread_create __use_ast_pthread_create_instead__
12 #endif
14 @@ -591,6 +591,10 @@ int ast_atomic_fetchadd_int_slow(volatil
15 #include "libkern/OSAtomic.h"
16 #endif
18 +#if defined(HAVE_SYS_ATOMIC_H)
19 +#include <sys/atomic.h>
20 +#endif
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;
29 +})
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;
34 +})
35 #elif defined (__i386__) || defined(__x86_64__)
36 #ifdef sun
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;
42 +})
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;
47 +})
48 #else
49 AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p),