diff options
author | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2007-10-22 11:08:52 +0000 |
---|---|---|
committer | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2007-10-22 11:08:52 +0000 |
commit | fea77015a89ef8e657443806bf04bf8c00e9b668 (patch) | |
tree | 57ea2ab3fd60bbc2a5a206feb5914fba15c30ce5 /atomic | |
parent | f97b80df72a85ae952cb1b0f7aa1a3eb9c7783cc (diff) | |
download | libapr-fea77015a89ef8e657443806bf04bf8c00e9b668.tar.gz |
implement apr_atomic_xchgptr() 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@587057 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'atomic')
-rw-r--r-- | atomic/os390/atomic.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/atomic/os390/atomic.c b/atomic/os390/atomic.c index 3c57668be..1d44ca3d1 100644 --- a/atomic/os390/atomic.c +++ b/atomic/os390/atomic.c @@ -118,3 +118,20 @@ apr_uint32_t apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val) return old; } +APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem_ptr, void *new_ptr) +{ + void *old_ptr; + + old_ptr = *(void **)mem_ptr; /* old is automatically updated on cs failure */ +#if APR_SIZEOF_VOIDP == 4 + do { + } while (__cs1(&old_ptr, mem_ptr, &new_ptr)); +#elif APR_SIZEOF_VOIDP == 8 + do { + } while (__csg(&old_ptr, mem_ptr, &new_ptr)); +#else +#error APR_SIZEOF_VOIDP value not supported +#endif /* APR_SIZEOF_VOIDP */ + + return old_ptr; +} |