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);
19 printf("load: %u\n", load_32(&shared));
22 void threadB(void *arg)
24 mcs_mutex::guard g(mutex);
25 printf("load: %u\n", load_32(&shared));
28 printf("store: %d\n", 17);
29 store_32(&shared, 17);
32 int user_main(int argc, char **argv)
36 mutex = new mcs_mutex();
38 thrd_create(&A, &threadA, NULL);
39 thrd_create(&B, &threadB, NULL);