X-Git-Url: http://plrg.eecs.uci.edu/git/?p=model-checker.git;a=blobdiff_plain;f=test%2Freleaseseq.c;h=a63fa93620bb3601e6dbded7f8cff0e6fe92ebfb;hp=d3127f392206be6609fd20476a11ad730cfcb7d2;hb=e9054c67ca7c2f2b577a70396de09b874d9a0fc0;hpb=0170878f8a8be6aa06af6591e50fffdb2ce54022 diff --git a/test/releaseseq.c b/test/releaseseq.c index d3127f3..a63fa93 100644 --- a/test/releaseseq.c +++ b/test/releaseseq.c @@ -5,15 +5,17 @@ */ #include +#include +#include -#include "libthreads.h" #include "librace.h" -#include "stdatomic.h" atomic_int x; +int var = 0; static void a(void *obj) { + store_32(&var, 1); atomic_store_explicit(&x, 1, memory_order_release); atomic_store_explicit(&x, 42, memory_order_relaxed); } @@ -21,7 +23,8 @@ static void a(void *obj) static void b(void *obj) { int r = atomic_load_explicit(&x, memory_order_acquire); - printf("r = %u\n", r); + printf("r = %d\n", r); + printf("load %d\n", load_32(&var)); } static void c(void *obj) @@ -29,7 +32,7 @@ static void c(void *obj) atomic_store_explicit(&x, 2, memory_order_relaxed); } -void user_main() +int user_main(int argc, char **argv) { thrd_t t1, t2, t3; @@ -44,4 +47,6 @@ void user_main() thrd_join(t2); thrd_join(t3); printf("Thread %d is finished\n", thrd_current()); + + return 0; }