4 #include "mcs-lock-wildcard.h"
6 /* For data race instrumentation */
9 struct mcs_mutex *mutex;
10 static atomic_int shared;
12 void threadA(void *arg)
14 mcs_mutex::guard g(mutex);
15 printf("store: %d\n", 17);
16 //store_32(&shared, 17);
17 atomic_store_explicit(&shared, 17, relaxed);
20 //printf("load: %u\n", load_32(&shared));
21 atomic_load_explicit(&shared, relaxed);
24 void threadB(void *arg)
26 mcs_mutex::guard g(mutex);
27 //printf("load: %u\n", load_32(&shared));
28 atomic_load_explicit(&shared, relaxed);
31 atomic_store_explicit(&shared, 17, relaxed);
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);