Lines 28-45
APR_DECLARE(apr_status_t) apr_atomic_ini
Link Here
|
28 |
* as the arguments for as our apr_atomic_foo32 Functions |
28 |
* as the arguments for as our apr_atomic_foo32 Functions |
29 |
*/ |
29 |
*/ |
30 |
typedef WINBASEAPI apr_uint32_t (WINAPI * apr_atomic_win32_ptr_fn) |
30 |
typedef WINBASEAPI apr_uint32_t (WINAPI * apr_atomic_win32_ptr_fn) |
31 |
(apr_uint32_t volatile *); |
31 |
(apr_uint32_t *); |
32 |
typedef WINBASEAPI apr_uint32_t (WINAPI * apr_atomic_win32_ptr_val_fn) |
32 |
typedef WINBASEAPI apr_uint32_t (WINAPI * apr_atomic_win32_ptr_val_fn) |
33 |
(apr_uint32_t volatile *, |
33 |
(apr_uint32_t *, |
34 |
apr_uint32_t); |
34 |
apr_uint32_t); |
35 |
typedef WINBASEAPI apr_uint32_t (WINAPI * apr_atomic_win32_ptr_val_val_fn) |
35 |
typedef WINBASEAPI apr_uint32_t (WINAPI * apr_atomic_win32_ptr_val_val_fn) |
36 |
(apr_uint32_t volatile *, |
36 |
(apr_uint32_t *, |
37 |
apr_uint32_t, apr_uint32_t); |
37 |
apr_uint32_t, apr_uint32_t); |
38 |
typedef WINBASEAPI void * (WINAPI * apr_atomic_win32_ptr_ptr_ptr_fn) |
38 |
typedef WINBASEAPI void * (WINAPI * apr_atomic_win32_ptr_ptr_ptr_fn) |
39 |
(volatile void **, |
39 |
(void **, |
40 |
void *, const void *); |
40 |
void *, const void *); |
41 |
|
41 |
|
42 |
APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val) |
42 |
APR_DECLARE(apr_uint32_t) apr_atomic_add32(apr_uint32_t *mem, apr_uint32_t val) |
43 |
{ |
43 |
{ |
44 |
#if (defined(_M_IA64) || defined(_M_AMD64)) |
44 |
#if (defined(_M_IA64) || defined(_M_AMD64)) |
45 |
return InterlockedExchangeAdd(mem, val); |
45 |
return InterlockedExchangeAdd(mem, val); |
Lines 53-59
APR_DECLARE(apr_uint32_t) apr_atomic_add
Link Here
|
53 |
/* Of course we want the 2's compliment of the unsigned value, val */ |
53 |
/* Of course we want the 2's compliment of the unsigned value, val */ |
54 |
#pragma warning(disable: 4146) |
54 |
#pragma warning(disable: 4146) |
55 |
|
55 |
|
56 |
APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val) |
56 |
APR_DECLARE(void) apr_atomic_sub32(apr_uint32_t *mem, apr_uint32_t val) |
57 |
{ |
57 |
{ |
58 |
#if (defined(_M_IA64) || defined(_M_AMD64)) |
58 |
#if (defined(_M_IA64) || defined(_M_AMD64)) |
59 |
InterlockedExchangeAdd(mem, -val); |
59 |
InterlockedExchangeAdd(mem, -val); |
Lines 64-70
APR_DECLARE(void) apr_atomic_sub32(volat
Link Here
|
64 |
#endif |
64 |
#endif |
65 |
} |
65 |
} |
66 |
|
66 |
|
67 |
APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem) |
67 |
APR_DECLARE(apr_uint32_t) apr_atomic_inc32(apr_uint32_t *mem) |
68 |
{ |
68 |
{ |
69 |
/* we return old value, win32 returns new value :( */ |
69 |
/* we return old value, win32 returns new value :( */ |
70 |
#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED) |
70 |
#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED) |
Lines 76-82
APR_DECLARE(apr_uint32_t) apr_atomic_inc
Link Here
|
76 |
#endif |
76 |
#endif |
77 |
} |
77 |
} |
78 |
|
78 |
|
79 |
APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem) |
79 |
APR_DECLARE(int) apr_atomic_dec32(apr_uint32_t *mem) |
80 |
{ |
80 |
{ |
81 |
#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED) |
81 |
#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED) |
82 |
return InterlockedDecrement(mem); |
82 |
return InterlockedDecrement(mem); |
Lines 87-93
APR_DECLARE(int) apr_atomic_dec32(volati
Link Here
|
87 |
#endif |
87 |
#endif |
88 |
} |
88 |
} |
89 |
|
89 |
|
90 |
APR_DECLARE(void) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val) |
90 |
APR_DECLARE(void) apr_atomic_set32(apr_uint32_t *mem, apr_uint32_t val) |
91 |
{ |
91 |
{ |
92 |
#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED) |
92 |
#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED) |
93 |
InterlockedExchange(mem, val); |
93 |
InterlockedExchange(mem, val); |
Lines 98-109
APR_DECLARE(void) apr_atomic_set32(volat
Link Here
|
98 |
#endif |
98 |
#endif |
99 |
} |
99 |
} |
100 |
|
100 |
|
101 |
APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem) |
101 |
APR_DECLARE(apr_uint32_t) apr_atomic_read32(apr_uint32_t *mem) |
102 |
{ |
102 |
{ |
103 |
return *mem; |
103 |
return *mem; |
104 |
} |
104 |
} |
105 |
|
105 |
|
106 |
APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with, |
106 |
APR_DECLARE(apr_uint32_t) apr_atomic_cas32(apr_uint32_t *mem, apr_uint32_t with, |
107 |
apr_uint32_t cmp) |
107 |
apr_uint32_t cmp) |
108 |
{ |
108 |
{ |
109 |
#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED) |
109 |
#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED) |
Lines 115-121
APR_DECLARE(apr_uint32_t) apr_atomic_cas
Link Here
|
115 |
#endif |
115 |
#endif |
116 |
} |
116 |
} |
117 |
|
117 |
|
118 |
APR_DECLARE(void *) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp) |
118 |
APR_DECLARE(void *) apr_atomic_casptr(void **mem, void *with, void *cmp) |
119 |
{ |
119 |
{ |
120 |
#if (defined(_M_IA64) || defined(_M_AMD64) || defined(__MINGW32__)) && !defined(RC_INVOKED) |
120 |
#if (defined(_M_IA64) || defined(_M_AMD64) || defined(__MINGW32__)) && !defined(RC_INVOKED) |
121 |
return InterlockedCompareExchangePointer((void**)mem, with, (void*)cmp); |
121 |
return InterlockedCompareExchangePointer((void**)mem, with, (void*)cmp); |
Lines 125-131
APR_DECLARE(void *) apr_atomic_casptr(vo
Link Here
|
125 |
#endif |
125 |
#endif |
126 |
} |
126 |
} |
127 |
|
127 |
|
128 |
APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val) |
128 |
APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(apr_uint32_t *mem, apr_uint32_t val) |
129 |
{ |
129 |
{ |
130 |
#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED) |
130 |
#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED) |
131 |
return InterlockedExchange(mem, val); |
131 |
return InterlockedExchange(mem, val); |