2 * This test performs some relaxes, release, acquire opeations on a single
3 * atomic variable. It is designed for creating a difficult set of pending
4 * release sequences to resolve at the end of an execution. However, it
5 * utilizes 6 threads, so it blows up into a lot of executions quickly.
10 #include <stdatomic.h>
17 static void a(void *obj)
20 atomic_store_explicit(&x, *((int *)obj), memory_order_release);
21 atomic_store_explicit(&x, *((int *)obj) + 1, memory_order_relaxed);
24 static void b2(void *obj)
26 int r = atomic_load_explicit(&x, memory_order_acquire);
27 printf("r = %d\n", r);
31 static void b1(void *obj)
35 int r = atomic_load_explicit(&x, memory_order_acquire);
36 printf("r = %d\n", r);
38 thrd_create(&t3, (thrd_start_t)&a, &i);
39 thrd_create(&t4, (thrd_start_t)&b2, NULL);
44 static void c(void *obj)
46 atomic_store_explicit(&x, 22, memory_order_relaxed);
49 int user_main(int argc, char **argv)
56 thrd_create(&t1, (thrd_start_t)&a, &i);
57 thrd_create(&t2, (thrd_start_t)&b1, NULL);
58 thrd_create(&t5, (thrd_start_t)&c, NULL);