From 09592530fc40cdf3eb049c1adb7f26066a450e16 Mon Sep 17 00:00:00 2001 From: Brian Demsky Date: Wed, 12 Sep 2012 22:59:03 -0700 Subject: [PATCH] commit new test case --- test/rmwprog.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test/rmwprog.c diff --git a/test/rmwprog.c b/test/rmwprog.c new file mode 100644 index 00000000..14929ee2 --- /dev/null +++ b/test/rmwprog.c @@ -0,0 +1,26 @@ +#include + +#include "libthreads.h" +#include "librace.h" +#include "stdatomic.h" + +atomic_int x; + +static void a(void *obj) +{ + atomic_fetch_add_explicit(&x, 1, memory_order_relaxed); + atomic_fetch_add_explicit(&x, 1, memory_order_relaxed); +} + +void user_main() +{ + thrd_t t1, t2; + + atomic_init(&x, 0); + + thrd_create(&t1, (thrd_start_t)&a, NULL); + thrd_create(&t2, (thrd_start_t)&a, NULL); + + thrd_join(t1); + thrd_join(t2); +} -- 2.34.1