mcs-lock: bugfix - didn't allocate mcs_mutex
authorBrian Norris <banorris@uci.edu>
Wed, 10 Oct 2012 02:08:01 +0000 (19:08 -0700)
committerBrian Norris <banorris@uci.edu>
Wed, 10 Oct 2012 02:08:01 +0000 (19:08 -0700)
This is a bug in the stupid driver I wrote (i.e., my fault). I was
struggling with the syntax, so I forgot to even initialize my objects.

mcs-lock/mcs-lock.cc

index 135085f95b9d26bb43e40815a04e36f4452980f6..6ba8f18a9a9bbca6762f65258377bf03330a4802 100644 (file)
@@ -3,12 +3,12 @@
 
 #include "mcs-lock.h"
 
 
 #include "mcs-lock.h"
 
-struct mcs_mutex *mutex;
+struct mcs_mutex mutex;
 
 int user_main(int argc, char **argv)
 {
 
 int user_main(int argc, char **argv)
 {
-       mcs_mutex::guard *g = new mcs_mutex::guard(mutex);
-       mutex->lock(g);
-       mutex->unlock(g);
+       mcs_mutex::guard *g = new mcs_mutex::guard(&mutex);
+       mutex.lock(g);
+       mutex.unlock(g);
        return 0;
 }
        return 0;
 }