I didn't notice that the guard automatically locks/unlocks the mutex on
creation/destruction, respectively.
void threadA(void *arg)
{
mcs_mutex::guard g(mutex);
void threadA(void *arg)
{
mcs_mutex::guard g(mutex);
printf("store: %d\n", 17);
store_32(&shared, 17);
printf("store: %d\n", 17);
store_32(&shared, 17);
}
void threadB(void *arg)
{
mcs_mutex::guard g(mutex);
}
void threadB(void *arg)
{
mcs_mutex::guard g(mutex);
printf("load: %u\n", load_32(&shared));
printf("load: %u\n", load_32(&shared));
}
int user_main(int argc, char **argv)
}
int user_main(int argc, char **argv)