snapshot: more renaming
[c11tester.git] / test / rmwprog.c
1 #include <stdio.h>
2 #include <threads.h>
3 #include <stdatomic.h>
4
5 #include "librace.h"
6
7 atomic_int x;
8
9 static void a(void *obj)
10 {
11         atomic_fetch_add_explicit(&x, 1, memory_order_relaxed);
12         atomic_fetch_add_explicit(&x, 1, memory_order_relaxed);
13 }
14
15 int user_main(int argc, char **argv)
16 {
17         thrd_t t1, t2;
18
19         atomic_init(&x, 0);
20         thrd_create(&t1, (thrd_start_t)&a, NULL);
21         thrd_create(&t2, (thrd_start_t)&a, NULL);
22
23         thrd_join(t1);
24         thrd_join(t2);
25
26         return 0;
27 }