3 * @brief Independent read and independent write test
11 //#include "wildcard.h"
12 //#include "model-assert.h"
17 int r1, r2, r3, r4; /* "local" variables */
19 static void *a(void *obj)
21 // x.store(1, memory_order_seq_cst);
26 static void *b(void *obj)
28 y.store(1, memory_order_seq_cst);
32 static void *c(void *obj)
34 r1 = x.load(memory_order_acquire);
35 r2 = y.load(memory_order_seq_cst);
39 static void *d(void *obj)
41 r3 = y.load(memory_order_acquire);
42 r4 = x.load(memory_order_seq_cst);
47 int user_main(int argc, char **argv)
49 pthread_t threads[20];
54 printf("Main thread: creating %d threads\n", N);
56 for (int i = 0; i< N; i++)
57 pthread_create(&threads[i],NULL, &a, NULL);
59 for (int i=0; i<N; i++)
60 printf("thread id: %ld\n", threads[i]);
62 for (int i = 0; i< N; i++)
63 pthread_join( threads[i],NULL);
65 printf("Main thread is finished\n");
68 * This condition should not be hit if the execution is SC */
69 // bool sc = (r1 == 1 && r2 == 0 && r3 == 1 && r4 == 0);
70 // printf("r1 = %d, r2 = %d, r3 = %d and r4 = %d\n", r1, r2, r3, r4);