apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Jones" <oscare...@gmail.com>
Subject PATCH: zOS specific implementation of apr_atomic_xchgptr
Date Fri, 19 Oct 2007 18:37:43 GMT
revision 554995 introduced apr_atomic_xchgptr, but did not have the os390
implementation.

This will allow test/testatomic.c at trunk (it tests apr_atomic_xchgptr for
all platforms) to compile and tests successfully on zOS.

Index: atomic/os390/atomic.c
===================================================================
--- atomic/os390/atomic.c       (revision 586569)
+++ atomic/os390/atomic.c       (working copy)
@@ -118,3 +118,20 @@
     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;
+}

Mime
View raw message