Lines 24-70
APR_DECLARE(apr_status_t) apr_atomic_ini
Link Here
|
24 |
return APR_SUCCESS; |
24 |
return APR_SUCCESS; |
25 |
} |
25 |
} |
26 |
|
26 |
|
27 |
APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val) |
27 |
APR_DECLARE(apr_uint32_t) apr_atomic_add32(apr_uint32_t *mem, apr_uint32_t val) |
28 |
{ |
28 |
{ |
29 |
return atomic_xchgadd((unsigned long *)mem,(unsigned long)val); |
29 |
return atomic_xchgadd((unsigned long *)mem,(unsigned long)val); |
30 |
} |
30 |
} |
31 |
|
31 |
|
32 |
APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val) |
32 |
APR_DECLARE(void) apr_atomic_sub32(apr_uint32_t *mem, apr_uint32_t val) |
33 |
{ |
33 |
{ |
34 |
atomic_sub((unsigned long *)mem,(unsigned long)val); |
34 |
atomic_sub((unsigned long *)mem,(unsigned long)val); |
35 |
} |
35 |
} |
36 |
|
36 |
|
37 |
APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem) |
37 |
APR_DECLARE(apr_uint32_t) apr_atomic_inc32(apr_uint32_t *mem) |
38 |
{ |
38 |
{ |
39 |
return atomic_xchgadd((unsigned long *)mem, 1); |
39 |
return atomic_xchgadd((unsigned long *)mem, 1); |
40 |
} |
40 |
} |
41 |
|
41 |
|
42 |
APR_DECLARE(void) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val) |
42 |
APR_DECLARE(void) apr_atomic_set32(apr_uint32_t *mem, apr_uint32_t val) |
43 |
{ |
43 |
{ |
44 |
*mem = val; |
44 |
*mem = val; |
45 |
} |
45 |
} |
46 |
|
46 |
|
47 |
APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem) |
47 |
APR_DECLARE(apr_uint32_t) apr_atomic_read32(apr_uint32_t *mem) |
48 |
{ |
48 |
{ |
49 |
return *mem; |
49 |
return *mem; |
50 |
} |
50 |
} |
51 |
|
51 |
|
52 |
APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with,apr_uint32_t cmp) |
52 |
APR_DECLARE(apr_uint32_t) apr_atomic_cas32(apr_uint32_t *mem, apr_uint32_t with,apr_uint32_t cmp) |
53 |
{ |
53 |
{ |
54 |
return atomic_cmpxchg((unsigned long *)mem,(unsigned long)cmp,(unsigned long)with); |
54 |
return atomic_cmpxchg((unsigned long *)mem,(unsigned long)cmp,(unsigned long)with); |
55 |
} |
55 |
} |
56 |
|
56 |
|
57 |
APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val) |
57 |
APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(apr_uint32_t *mem, apr_uint32_t val) |
58 |
{ |
58 |
{ |
59 |
return atomic_xchg((unsigned long *)mem,(unsigned long)val); |
59 |
return atomic_xchg((unsigned long *)mem,(unsigned long)val); |
60 |
} |
60 |
} |
61 |
|
61 |
|
62 |
APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem) |
62 |
APR_DECLARE(int) apr_atomic_dec32(apr_uint32_t *mem) |
63 |
{ |
63 |
{ |
64 |
return (atomic_xchgadd((unsigned long *)mem, 0xFFFFFFFF) - 1); |
64 |
return (atomic_xchgadd((unsigned long *)mem, 0xFFFFFFFF) - 1); |
65 |
} |
65 |
} |
66 |
|
66 |
|
67 |
APR_DECLARE(void *) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp) |
67 |
APR_DECLARE(void *) apr_atomic_casptr(void **mem, void *with, void *cmp) |
68 |
{ |
68 |
{ |
69 |
return (void*)atomic_cmpxchg((unsigned long *)mem,(unsigned long)cmp,(unsigned long)with); |
69 |
return (void*)atomic_cmpxchg((unsigned long *)mem,(unsigned long)cmp,(unsigned long)with); |
70 |
} |
70 |
} |