summaryrefslogtreecommitdiff
path: root/test/testatomic.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/testatomic.c')
-rw-r--r--test/testatomic.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/testatomic.c b/test/testatomic.c
index c2f1e46da..b66129924 100644
--- a/test/testatomic.c
+++ b/test/testatomic.c
@@ -876,6 +876,43 @@ static void test_atomics_busyloop_threaded64(abts_case *tc, void *data)
ABTS_ASSERT(tc, "Failed creating threads", rv == APR_SUCCESS);
}
+void *APR_THREAD_FUNC test_func_set64(apr_thread_t *thd, void *data)
+{
+ int i;
+
+ for (i = 0; i < 1000 * 1000; i++) {
+ apr_atomic_set64(&atomic_ops64, APR_UINT64_C(0x1111222233334444));
+ apr_atomic_set64(&atomic_ops64, APR_UINT64_C(0x4444555566667777));
+ }
+
+ apr_thread_exit(thd, APR_SUCCESS);
+ return NULL;
+}
+
+static void test_atomics_threaded_setread64(abts_case *tc, void *data)
+{
+ apr_status_t retval;
+ apr_thread_t *thread;
+ int i;
+
+ apr_atomic_set64(&atomic_ops64, APR_UINT64_C(0x1111222233334444));
+
+ apr_thread_create(&thread, NULL, test_func_set64, NULL, p);
+
+ for (i = 0; i < 1000 * 1000 * 2; i++) {
+ apr_uint64_t val = apr_atomic_read64(&atomic_ops64);
+
+ if (val != APR_UINT64_C(0x1111222233334444) &&
+ val != APR_UINT64_C(0x4444555566667777))
+ {
+ ABTS_FAIL(tc, "Unexpected value");
+ break;
+ }
+ }
+
+ apr_thread_join(&retval, thread);
+}
+
#endif /* !APR_HAS_THREADS */
abts_suite *testatomic(abts_suite *suite)
@@ -916,6 +953,7 @@ abts_suite *testatomic(abts_suite *suite)
abts_run_test(suite, test_atomics_threaded64, NULL);
abts_run_test(suite, test_atomics_busyloop_threaded, NULL);
abts_run_test(suite, test_atomics_busyloop_threaded64, NULL);
+ abts_run_test(suite, test_atomics_threaded_setread64, NULL);
#endif
return suite;