summaryrefslogtreecommitdiff
path: root/test/testatomic.c
diff options
context:
space:
mode:
authorDavi Arnaut <davi@apache.org>2007-07-10 16:35:45 +0000
committerDavi Arnaut <davi@apache.org>2007-07-10 16:35:45 +0000
commit99f54f536886d68d1d6b13dad297b8fb7741232c (patch)
treebda6af4a9c2930481adffbb7fcbeb8a3e4c11eb7 /test/testatomic.c
parenteb6350350b65c10903b2dc13a6b92cf3aa4ce5c0 (diff)
downloadapr-99f54f536886d68d1d6b13dad297b8fb7741232c.tar.gz
Introduce apr_atomic_xchgptr, which atomically exchanges a pair of pointer
values. Missing OS/390 implementation. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@554995 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/testatomic.c')
-rw-r--r--test/testatomic.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/testatomic.c b/test/testatomic.c
index b9fe6279d..0d09d004e 100644
--- a/test/testatomic.c
+++ b/test/testatomic.c
@@ -81,6 +81,17 @@ static void test_xchg32(abts_case *tc, void *data)
ABTS_INT_EQUAL(tc, 50, y32);
}
+static void test_xchgptr(abts_case *tc, void *data)
+{
+ int a;
+ volatile void *target_ptr = NULL;
+ void *old_ptr;
+
+ old_ptr = apr_atomic_xchgptr(&target_ptr, &a);
+ ABTS_PTR_EQUAL(tc, NULL, old_ptr);
+ ABTS_PTR_EQUAL(tc, &a, (void *) target_ptr);
+}
+
static void test_cas_equal(abts_case *tc, void *data)
{
apr_uint32_t casval = 0;
@@ -489,6 +500,7 @@ abts_suite *testatomic(abts_suite *suite)
abts_run_test(suite, test_read32, NULL);
abts_run_test(suite, test_dec32, NULL);
abts_run_test(suite, test_xchg32, NULL);
+ abts_run_test(suite, test_xchgptr, NULL);
abts_run_test(suite, test_cas_equal, NULL);
abts_run_test(suite, test_cas_equal_nonnull, NULL);
abts_run_test(suite, test_cas_notequal, NULL);