3 * @brief Independent read and independent write test
11 #include "model-assert.h"
16 int r1, r2, r3, r4; /* "local" variables */
18 static void a(void *obj)
20 x.store(1, wildcard(1));
23 static void b(void *obj)
25 y.store(1, wildcard(2));
28 static void c(void *obj)
30 r1 = x.load(wildcard(3));
31 r2 = y.load(wildcard(4));
34 static void d(void *obj)
36 r3 = y.load(wildcard(5));
37 r4 = x.load(wildcard(6));
41 int user_main(int argc, char **argv)
43 thrd_t t1, t2, t3, t4;
48 printf("Main thread: creating 4 threads\n");
49 thrd_create(&t1, (thrd_start_t)&a, NULL);
50 thrd_create(&t2, (thrd_start_t)&b, NULL);
51 thrd_create(&t3, (thrd_start_t)&c, NULL);
52 thrd_create(&t4, (thrd_start_t)&d, NULL);
58 printf("Main thread is finished\n");
61 * This condition should not be hit if the execution is SC */
62 bool sc = (r1 == 1 && r2 == 0 && r3 == 1 && r4 == 0);