mpmc-queue: makefile bugfix
[model-checker-benchmarks.git] / mcs-lock / mcs-lock.cc
index a541a2e4d919c0229234e5a38a2daba8ddef4bf1..ec0cc5df9d55c904d3a5cf9a677f42488371a7bb 100644 (file)
@@ -12,18 +12,21 @@ static uint32_t shared;
 void threadA(void *arg)
 {
        mcs_mutex::guard g(mutex);
-       mutex->lock(&g);
        printf("store: %d\n", 17);
        store_32(&shared, 17);
        mutex->unlock(&g);
+       mutex->lock(&g);
+       printf("load: %u\n", load_32(&shared));
 }
 
 void threadB(void *arg)
 {
        mcs_mutex::guard g(mutex);
-       mutex->lock(&g);
        printf("load: %u\n", load_32(&shared));
        mutex->unlock(&g);
+       mutex->lock(&g);
+       printf("store: %d\n", 17);
+       store_32(&shared, 17);
 }
 
 int user_main(int argc, char **argv)