Create a z/OS implementation of apr_atomic_casptr.

Note: we don't need the -enable-nonportable-atomics flag as the atomic/os390 directory implementations will always be used first if they exist


Passes apr/test/testatomic at 1.2.x level, which includes:
          Revision 582493 - (view) (download) (annotate) - [select for diffs]
Modified Sat Oct 6 12:46:08 2007 UTC (3 days, 5 hours ago) by trawick
File length: 9659 byte(s)
Diff to previous 428331 (colored)
merge r505091 and r552360 from trunk

r505091: add a test for apr_atomic_casptr, used in the
httpd worker and event MPMs

Passes apr/test/testatomic at trunk, at 554294 level, which does not include the following test of apr_atomic_xchgptr (which does not yet have a zOS implementation, but is also not in httpd 2.2.6):
          Revision 554995 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jul 10 16:35:45 2007 UTC (2 months, 4 weeks ago) by davi
File length: 13674 byte(s)
Diff to previous 554294 (colored)
Introduce apr_atomic_xchgptr, which atomically exchanges a pair of pointer
values. Missing OS/390 implementation.




Index: atomic/os390/atomic.c
===================================================================
--- atomic/os390/atomic.c       (revision 583255)
+++ atomic/os390/atomic.c       (working copy)
@@ -82,6 +82,30 @@
     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 __cds1 failure */
+            mem_ptr,     /* set from swap when __cds1 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 __cds1 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;