8 static void a(void *obj)
10 x.store(1, std::memory_order_release);
13 static void b(void *obj)
15 y.store(1, std::memory_order_release);
18 static void c(void *obj)
20 printf("x1: %d\n", x.load(std::memory_order_acquire));
21 printf("y1: %d\n", y.load(std::memory_order_acquire));
24 static void d(void *obj)
26 printf("y2: %d\n", y.load(std::memory_order_acquire));
27 printf("x2: %d\n", x.load(std::memory_order_acquire));
30 int user_main(int argc, char **argv)
32 thrd_t t1, t2, t3, t4;
37 printf("Main thread: creating 4 threads\n");
38 thrd_create(&t1, (thrd_start_t)&a, NULL);
39 thrd_create(&t2, (thrd_start_t)&b, NULL);
40 thrd_create(&t3, (thrd_start_t)&c, NULL);
41 thrd_create(&t4, (thrd_start_t)&d, NULL);
47 printf("Main thread is finished\n");