From: Brian Norris Date: Thu, 11 Oct 2012 01:33:27 +0000 (-0700) Subject: mcs-lock: driver bugfix (deadlocking) X-Git-Tag: pldi2013~39 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=model-checker-benchmarks.git;a=commitdiff_plain;h=efc422a9ae20513f8a69b1cd53cb13de62dd4218 mcs-lock: driver bugfix (deadlocking) I didn't notice that the guard automatically locks/unlocks the mutex on creation/destruction, respectively. --- diff --git a/mcs-lock/mcs-lock.cc b/mcs-lock/mcs-lock.cc index a541a2e..26e5a27 100644 --- a/mcs-lock/mcs-lock.cc +++ b/mcs-lock/mcs-lock.cc @@ -12,18 +12,14 @@ 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); } void threadB(void *arg) { mcs_mutex::guard g(mutex); - mutex->lock(&g); printf("load: %u\n", load_32(&shared)); - mutex->unlock(&g); } int user_main(int argc, char **argv)