diff options
author | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2007-10-18 12:11:46 +0000 |
---|---|---|
committer | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2007-10-18 12:11:46 +0000 |
commit | aa062954aba16dc206811f78cf579a1401da1f04 (patch) | |
tree | cbaa1ff0656b7cedade8da7add91057aaabc7ea9 /atomic | |
parent | 7f1524fcefaeae349782ae3dd79be9da71cf2965 (diff) | |
download | libapr-aa062954aba16dc206811f78cf579a1401da1f04.tar.gz |
Implement apr_atomic_casptr() for z/OS.
Submitted by: David Jones <oscaremma gmail.com>
Reviewed by: trawick
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@585935 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'atomic')
-rw-r--r-- | atomic/os390/atomic.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/atomic/os390/atomic.c b/atomic/os390/atomic.c index 35ddf1c22..3c57668be 100644 --- a/atomic/os390/atomic.c +++ b/atomic/os390/atomic.c @@ -82,6 +82,30 @@ apr_uint32_t apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t swap, return old; /* old is automatically updated from mem on cs failure */ } +#if APR_SIZEOF_VOIDP == 4 +void *apr_atomic_casptr(volatile void **mem_ptr, + void *swap_ptr, + const void *cmp_ptr) +{ + __cs1(&cmp_ptr, /* automatically updated from mem on __cs1 failure */ + mem_ptr, /* set from swap when __cs1 succeeds */ + &swap_ptr); + return (void *)cmp_ptr; +} +#elif APR_SIZEOF_VOIDP == 8 +void *apr_atomic_casptr(volatile void **mem_ptr, + void *swap_ptr, + const void *cmp_ptr) +{ + __csg(&cmp_ptr, /* automatically updated from mem on __csg failure */ + mem_ptr, /* set from swap when __csg succeeds */ + &swap_ptr); + return (void *)cmp_ptr; +} +#else +#error APR_SIZEOF_VOIDP value not supported +#endif /* APR_SIZEOF_VOIDP */ + apr_uint32_t apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val) { apr_uint32_t old, new_val; |