You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by tr...@apache.org on 2007/10/22 13:08:54 UTC
svn commit: r587057 - in /apr/apr/trunk: CHANGES atomic/os390/atomic.c
Author: trawick
Date: Mon Oct 22 04:08:52 2007
New Revision: 587057
URL: http://svn.apache.org/viewvc?rev=587057&view=rev
Log:
implement apr_atomic_xchgptr() for z/OS
Submitted by: David Jones <oscaremma gmail.com>
reviewed by: trawick
Modified:
apr/apr/trunk/CHANGES
apr/apr/trunk/atomic/os390/atomic.c
Modified: apr/apr/trunk/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/trunk/CHANGES?rev=587057&r1=587056&r2=587057&view=diff
==============================================================================
--- apr/apr/trunk/CHANGES [utf-8] (original)
+++ apr/apr/trunk/CHANGES [utf-8] Mon Oct 22 04:08:52 2007
@@ -1,7 +1,7 @@
-*- coding: utf-8 -*-
Changes for APR 1.3.0
- *) Implement apr_atomic_casptr() for z/OS.
+ *) Implement apr_atomic_casptr() and apr_atomic_xchgptr() for z/OS.
[David Jones <oscaremma gmail.com>]
*) Fill in apr_fileinfo_t member st_csize on Netware and Unix (PR 41678),
Modified: apr/apr/trunk/atomic/os390/atomic.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/atomic/os390/atomic.c?rev=587057&r1=587056&r2=587057&view=diff
==============================================================================
--- apr/apr/trunk/atomic/os390/atomic.c (original)
+++ apr/apr/trunk/atomic/os390/atomic.c Mon Oct 22 04:08:52 2007
@@ -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;
+}