From: Brian Demsky Date: Thu, 13 Sep 2012 05:59:03 +0000 (-0700) Subject: commit new test case X-Git-Tag: pldi2013~210 X-Git-Url: http://demsky.eecs.uci.edu/git/?p=model-checker.git;a=commitdiff_plain;h=09592530fc40cdf3eb049c1adb7f26066a450e16 commit new test case --- diff --git a/test/rmwprog.c b/test/rmwprog.c new file mode 100644 index 0000000..14929ee --- /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); +}