projects
/
model-checker-benchmarks.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6c65f26
)
mcs-lock: driver bugfix (deadlocking)
author
Brian Norris
<computersforpeace@gmail.com>
Thu, 11 Oct 2012 01:33:27 +0000
(18:33 -0700)
committer
Brian Norris
<computersforpeace@gmail.com>
Thu, 11 Oct 2012 01:33:27 +0000
(18:33 -0700)
I didn't notice that the guard automatically locks/unlocks the mutex on
creation/destruction, respectively.
mcs-lock/mcs-lock.cc
patch
|
blob
|
history
diff --git
a/mcs-lock/mcs-lock.cc
b/mcs-lock/mcs-lock.cc
index a541a2e4d919c0229234e5a38a2daba8ddef4bf1..26e5a27edb76da058cc352eabd5c300a8fdb0ca8 100644
(file)
--- 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)