You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by br...@apache.org on 2003/09/26 03:51:53 UTC
cvs commit: apr/atomic/unix apr_atomic.c
brianp 2003/09/25 18:51:53
Modified: test testatomic.c
atomic/unix apr_atomic.c
Log:
Fix default impl of apr_atomic_xchg32, and add a test case for it
Revision Changes Path
1.32 +13 -0 apr/test/testatomic.c
Index: testatomic.c
===================================================================
RCS file: /home/cvs/apr/test/testatomic.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- testatomic.c 25 Sep 2003 14:49:55 -0000 1.31
+++ testatomic.c 26 Sep 2003 01:51:53 -0000 1.32
@@ -184,6 +184,19 @@
}
printf("OK\n");
+ printf("%-60s", "testing apr_atomic_xchg32");
+ apr_atomic_set32(&y32, 100);
+ oldval = apr_atomic_xchg32(&y32, 50);
+ if (oldval != 100) {
+ fprintf(stderr, "Failed\noldval =%d should be 100\n", oldval);
+ return APR_EGENERAL;
+ }
+ if (y32 != 50) {
+ fprintf(stderr, "Failed\nnewval =%d should be 50\n", oldval);
+ return APR_EGENERAL;
+ }
+ printf("OK\n");
+
printf("%-60s", "testing apr_atomic_cas32");
oldval = apr_atomic_cas32(&casval, 12, 0);
if (oldval != 0) {
1.24 +1 -1 apr/atomic/unix/apr_atomic.c
Index: apr_atomic.c
===================================================================
RCS file: /home/cvs/apr/atomic/unix/apr_atomic.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- apr_atomic.c 25 Sep 2003 04:37:08 -0000 1.23
+++ apr_atomic.c 26 Sep 2003 01:51:53 -0000 1.24
@@ -306,7 +306,7 @@
prev = *mem;
*mem = val;
apr_thread_mutex_unlock(lock);
- return val;
+ return prev;
}
return *mem;
#else