3 #include "libthreads.h"
6 static void a(atomic_int *obj)
11 for (i = 0; i < 10; i++) {
12 printf("Thread %d, loop %d\n", thrd_current(), i);
15 ret = atomic_load(obj);
16 printf("Read value: %d\n", ret);
20 printf("Write value: %d\n", i);
33 printf("Creating 2 threads\n");
34 thrd_create(&t1, (thrd_start_t)&a, &obj);
35 thrd_create(&t2, (thrd_start_t)&a, &obj);
39 printf("Thread is finished\n");