6 #include "model-assert.h"
11 static void a(void *obj)
13 atomic_store_explicit(&x, 1, memory_order_relaxed);
14 atomic_thread_fence(memory_order_release);
15 atomic_store_explicit(&x, 2, memory_order_relaxed);
18 static void b(void *obj)
21 r1 = atomic_load_explicit(&x, memory_order_relaxed);
22 atomic_thread_fence(memory_order_acquire);
23 r2 = atomic_load_explicit(&x, memory_order_relaxed);
25 printf("FENCES: r1 = %d, r2 = %d\n", r1, r2);
27 MODEL_ASSERT(r2 != 1);
30 int user_main(int argc, char **argv)
37 printf("Main thread: creating 2 threads\n");
38 thrd_create(&t1, (thrd_start_t)&a, NULL);
39 thrd_create(&t2, (thrd_start_t)&b, NULL);
43 printf("Main thread is finishing\n");