Lines 25-31
apr_status_t apr_atomic_init(apr_pool_t
Link Here
|
25 |
return APR_SUCCESS; |
25 |
return APR_SUCCESS; |
26 |
} |
26 |
} |
27 |
|
27 |
|
28 |
apr_uint32_t apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val) |
28 |
apr_uint32_t apr_atomic_add32(apr_uint32_t *mem, apr_uint32_t val) |
29 |
{ |
29 |
{ |
30 |
apr_uint32_t old, new_val; |
30 |
apr_uint32_t old, new_val; |
31 |
|
31 |
|
Lines 36-42
apr_uint32_t apr_atomic_add32(volatile a
Link Here
|
36 |
return old; |
36 |
return old; |
37 |
} |
37 |
} |
38 |
|
38 |
|
39 |
void apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val) |
39 |
void apr_atomic_sub32(apr_uint32_t *mem, apr_uint32_t val) |
40 |
{ |
40 |
{ |
41 |
apr_uint32_t old, new_val; |
41 |
apr_uint32_t old, new_val; |
42 |
|
42 |
|
Lines 46-57
void apr_atomic_sub32(volatile apr_uint3
Link Here
|
46 |
} while (__cs(&old, (cs_t *)mem, new_val)); |
46 |
} while (__cs(&old, (cs_t *)mem, new_val)); |
47 |
} |
47 |
} |
48 |
|
48 |
|
49 |
apr_uint32_t apr_atomic_inc32(volatile apr_uint32_t *mem) |
49 |
apr_uint32_t apr_atomic_inc32(apr_uint32_t *mem) |
50 |
{ |
50 |
{ |
51 |
return apr_atomic_add32(mem, 1); |
51 |
return apr_atomic_add32(mem, 1); |
52 |
} |
52 |
} |
53 |
|
53 |
|
54 |
int apr_atomic_dec32(volatile apr_uint32_t *mem) |
54 |
int apr_atomic_dec32(apr_uint32_t *mem) |
55 |
{ |
55 |
{ |
56 |
apr_uint32_t old, new_val; |
56 |
apr_uint32_t old, new_val; |
57 |
|
57 |
|
Lines 63-79
int apr_atomic_dec32(volatile apr_uint32
Link Here
|
63 |
return new_val != 0; |
63 |
return new_val != 0; |
64 |
} |
64 |
} |
65 |
|
65 |
|
66 |
apr_uint32_t apr_atomic_read32(volatile apr_uint32_t *mem) |
66 |
apr_uint32_t apr_atomic_read32(apr_uint32_t *mem) |
67 |
{ |
67 |
{ |
68 |
return *mem; |
68 |
return *mem; |
69 |
} |
69 |
} |
70 |
|
70 |
|
71 |
void apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val) |
71 |
void apr_atomic_set32(apr_uint32_t *mem, apr_uint32_t val) |
72 |
{ |
72 |
{ |
73 |
*mem = val; |
73 |
*mem = val; |
74 |
} |
74 |
} |
75 |
|
75 |
|
76 |
apr_uint32_t apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t swap, |
76 |
apr_uint32_t apr_atomic_cas32(apr_uint32_t *mem, apr_uint32_t swap, |
77 |
apr_uint32_t cmp) |
77 |
apr_uint32_t cmp) |
78 |
{ |
78 |
{ |
79 |
apr_uint32_t old = cmp; |
79 |
apr_uint32_t old = cmp; |
Lines 82-88
apr_uint32_t apr_atomic_cas32(volatile a
Link Here
|
82 |
return old; /* old is automatically updated from mem on cs failure */ |
82 |
return old; /* old is automatically updated from mem on cs failure */ |
83 |
} |
83 |
} |
84 |
|
84 |
|
85 |
apr_uint32_t apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val) |
85 |
apr_uint32_t apr_atomic_xchg32(apr_uint32_t *mem, apr_uint32_t val) |
86 |
{ |
86 |
{ |
87 |
apr_uint32_t old, new_val; |
87 |
apr_uint32_t old, new_val; |
88 |
|
88 |
|