Lines 48-69
APR_DECLARE(apr_status_t) apr_atomic_ini
Link Here
|
48 |
|
48 |
|
49 |
/* |
49 |
/* |
50 |
* Atomic operations on 32-bit values |
50 |
* Atomic operations on 32-bit values |
51 |
* Note: Each of these functions internally implements a memory barrier |
51 |
* Note: Each of these functions internally issues a full memory barrier |
52 |
* on platforms that require it |
|
|
53 |
*/ |
52 |
*/ |
54 |
|
53 |
|
55 |
/** |
54 |
/** |
56 |
* atomically read an apr_uint32_t from memory |
55 |
* atomically read an apr_uint32_t from memory |
57 |
* @param mem the pointer |
56 |
* @param mem the pointer |
58 |
*/ |
57 |
*/ |
59 |
APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem); |
58 |
APR_DECLARE(apr_uint32_t) apr_atomic_read32(apr_uint32_t *mem); |
60 |
|
59 |
|
61 |
/** |
60 |
/** |
62 |
* atomically set an apr_uint32_t in memory |
61 |
* atomically set an apr_uint32_t in memory |
63 |
* @param mem pointer to the object |
62 |
* @param mem pointer to the object |
64 |
* @param val value that the object will assume |
63 |
* @param val value that the object will assume |
65 |
*/ |
64 |
*/ |
66 |
APR_DECLARE(void) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val); |
65 |
APR_DECLARE(void) apr_atomic_set32(apr_uint32_t *mem, apr_uint32_t val); |
67 |
|
66 |
|
68 |
/** |
67 |
/** |
69 |
* atomically add 'val' to an apr_uint32_t |
68 |
* atomically add 'val' to an apr_uint32_t |
Lines 71-98
APR_DECLARE(void) apr_atomic_set32(volat
Link Here
|
71 |
* @param val amount to add |
70 |
* @param val amount to add |
72 |
* @return old value pointed to by mem |
71 |
* @return old value pointed to by mem |
73 |
*/ |
72 |
*/ |
74 |
APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val); |
73 |
APR_DECLARE(apr_uint32_t) apr_atomic_add32(apr_uint32_t *mem, apr_uint32_t val); |
75 |
|
74 |
|
76 |
/** |
75 |
/** |
77 |
* atomically subtract 'val' from an apr_uint32_t |
76 |
* atomically subtract 'val' from an apr_uint32_t |
78 |
* @param mem pointer to the object |
77 |
* @param mem pointer to the object |
79 |
* @param val amount to subtract |
78 |
* @param val amount to subtract |
80 |
*/ |
79 |
*/ |
81 |
APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val); |
80 |
APR_DECLARE(void) apr_atomic_sub32(apr_uint32_t *mem, apr_uint32_t val); |
82 |
|
81 |
|
83 |
/** |
82 |
/** |
84 |
* atomically increment an apr_uint32_t by 1 |
83 |
* atomically increment an apr_uint32_t by 1 |
85 |
* @param mem pointer to the object |
84 |
* @param mem pointer to the object |
86 |
* @return old value pointed to by mem |
85 |
* @return old value pointed to by mem |
87 |
*/ |
86 |
*/ |
88 |
APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem); |
87 |
APR_DECLARE(apr_uint32_t) apr_atomic_inc32(apr_uint32_t *mem); |
89 |
|
88 |
|
90 |
/** |
89 |
/** |
91 |
* atomically decrement an apr_uint32_t by 1 |
90 |
* atomically decrement an apr_uint32_t by 1 |
92 |
* @param mem pointer to the atomic value |
91 |
* @param mem pointer to the atomic value |
93 |
* @return zero if the value becomes zero on decrement, otherwise non-zero |
92 |
* @return zero if the value becomes zero on decrement, otherwise non-zero |
94 |
*/ |
93 |
*/ |
95 |
APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem); |
94 |
APR_DECLARE(int) apr_atomic_dec32(apr_uint32_t *mem); |
96 |
|
95 |
|
97 |
/** |
96 |
/** |
98 |
* compare an apr_uint32_t's value with 'cmp'. |
97 |
* compare an apr_uint32_t's value with 'cmp'. |
Lines 102-109
APR_DECLARE(int) apr_atomic_dec32(volati
Link Here
|
102 |
* @param cmp the value to compare it to |
101 |
* @param cmp the value to compare it to |
103 |
* @return the old value of *mem |
102 |
* @return the old value of *mem |
104 |
*/ |
103 |
*/ |
105 |
APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with, |
104 |
APR_DECLARE(apr_uint32_t) apr_atomic_cas32(apr_uint32_t *mem, apr_uint32_t with, |
106 |
apr_uint32_t cmp); |
105 |
apr_uint32_t cmp); |
107 |
|
106 |
|
108 |
/** |
107 |
/** |
109 |
* exchange an apr_uint32_t's value with 'val'. |
108 |
* exchange an apr_uint32_t's value with 'val'. |
Lines 111-117
APR_DECLARE(apr_uint32_t) apr_atomic_cas
Link Here
|
111 |
* @param val what to swap it with |
110 |
* @param val what to swap it with |
112 |
* @return the old value of *mem |
111 |
* @return the old value of *mem |
113 |
*/ |
112 |
*/ |
114 |
APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val); |
113 |
APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(apr_uint32_t *mem, apr_uint32_t val); |
115 |
|
114 |
|
116 |
/** |
115 |
/** |
117 |
* compare the pointer's value with cmp. |
116 |
* compare the pointer's value with cmp. |
Lines 121-127
APR_DECLARE(apr_uint32_t) apr_atomic_xch
Link Here
|
121 |
* @param cmp the value to compare it to |
120 |
* @param cmp the value to compare it to |
122 |
* @return the old value of the pointer |
121 |
* @return the old value of the pointer |
123 |
*/ |
122 |
*/ |
124 |
APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp); |
123 |
APR_DECLARE(void*) apr_atomic_casptr(void **mem, void *with, void *cmp); |
125 |
|
124 |
|
126 |
/** @} */ |
125 |
/** @} */ |
127 |
|
126 |
|