8 static void a(void *obj)
10 x.store(1, std::memory_order_relaxed);
11 y.store(1, std::memory_order_relaxed);
14 static void b(void *obj)
16 printf("y1: %d\n", y.load(std::memory_order_relaxed));
17 printf("x1: %d\n", x.load(std::memory_order_relaxed));
20 static void c(void *obj)
22 printf("x2: %d\n", x.load(std::memory_order_relaxed));
23 printf("y2: %d\n", y.load(std::memory_order_relaxed));
26 int user_main(int argc, char **argv)
33 printf("Main thread: creating 3 threads\n");
34 thrd_create(&t1, (thrd_start_t)&a, NULL);
35 thrd_create(&t2, (thrd_start_t)&b, NULL);
36 thrd_create(&t3, (thrd_start_t)&c, NULL);
41 printf("Main thread is finished\n");