Remove C/C++11 header files that we don't really use
[satcheck.git] / test / function_microbenchmarks.c
1 #include <stdio.h>
2 #include <threads.h>
3
4 #include "libinterface.h"
5
6 int x;
7 int y;
8 int gr1;
9 int gr2;
10
11 static void a(void *obj)
12 {
13     int r1=load_32(&y);
14     if (r1) {
15         r1=42;
16         store_32(&x, r1);
17     } else {
18         r1=0;
19     }
20
21     store_32(&x, r1);
22
23     int r2 = load_32(&x);
24     int cond = r1 == r2;
25     if (cond) {
26         r2++;
27     }
28
29     int cas_value = rmw_32(CAS, &x, r1, r2);
30     int cas_value1;
31     cas_value1 = rmw_32(ADD, &y, r1, r1);
32 }
33
34 int user_main(int argc, char **argv)
35 {
36     thrd_t t1; thrd_t t2;
37
38     store_32(&x, 0);
39     store_32(&y, 0);
40
41     printf("Main thread: creating 2 threads\n");
42     thrd_create(&t1, (thrd_start_t)&a, NULL);
43
44     thrd_join(t1);
45     printf("Main thread is finished\n");
46     int lgr1=load_32(&gr1);
47
48     int lgr2=load_32(&gr2);
49     if (lgr1==42) {
50         if (lgr2==42) {
51         } else {
52         }
53     } else {
54     }
55
56     return 0;
57 }