2 * This test performs some relaxes, release, acquire opeations on a single
3 * atomic variable. It can give some rough idea of release sequence support but
4 * probably should be improved to give better information.
9 #include "libthreads.h"
11 #include "stdatomic.h"
15 static void a(void *obj)
17 atomic_store_explicit(&x, 1, memory_order_release);
18 atomic_store_explicit(&x, 42, memory_order_relaxed);
21 static void b(void *obj)
23 int r = atomic_load_explicit(&x, memory_order_acquire);
24 printf("r = %u\n", r);
27 static void c(void *obj)
29 atomic_store_explicit(&x, 2, memory_order_relaxed);
38 printf("Thread %d: creating 3 threads\n", thrd_current());
39 thrd_create(&t1, (thrd_start_t)&a, NULL);
40 thrd_create(&t2, (thrd_start_t)&b, NULL);
41 thrd_create(&t3, (thrd_start_t)&c, NULL);
46 printf("Thread %d is finished\n", thrd_current());