6 /* For data race instrumentation */
9 struct mcs_mutex *mutex;
10 static uint32_t shared;
12 void threadA(void *arg)
14 mcs_mutex::guard g(mutex);
15 //printf("store: %d\n", 17);
16 //store_32(&shared, 17);
17 mcs_unlock(mutex, &g);
21 //printf("load: %u\n", load_32(&shared));
24 void threadB(void *arg)
26 mcs_mutex::guard g(mutex);
27 //printf("load: %u\n", load_32(&shared));
28 mcs_unlock(mutex, &g);
32 //printf("store: %d\n", 17);
33 //store_32(&shared, 17);
36 int user_main(int argc, char **argv)
40 mutex = new mcs_mutex();
42 thrd_create(&A, &threadA, NULL);
43 thrd_create(&B, &threadB, NULL);