diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2012-08-23 13:31:57 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2012-08-23 13:31:57 +0200 |
commit | 07694570b09524881d01df7c857cc8f471f1ad04 (patch) | |
tree | 8cae77df7bb081c1b7d37a587d11c765769d3643 /server/src/mutex.cc | |
parent | 05732251c115b3538879ca523c461572115c6526 (diff) | |
parent | 909c48a297d7f68b107fce7ad444c2165f749f42 (diff) |
Merge branch 'master' of http://git.aasimon.org/public/pracro
Diffstat (limited to 'server/src/mutex.cc')
-rw-r--r-- | server/src/mutex.cc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/server/src/mutex.cc b/server/src/mutex.cc index ec0d0e8..9805591 100644 --- a/server/src/mutex.cc +++ b/server/src/mutex.cc @@ -27,6 +27,11 @@ */ #include "mutex.h" +#include "debug.h" + +#define MUTEX_DBG(x) +//#define MUTEX_DBG(x) x + Mutex::Mutex() { pthread_mutex_init (&mutex, NULL); @@ -39,16 +44,23 @@ Mutex::~Mutex() bool Mutex::trylock() { - return pthread_mutex_trylock(&mutex) == 0; + bool ret = pthread_mutex_trylock(&mutex) == 0; + + if(ret) MUTEX_DBG(printf("trylock succeeded on %s\n", name.c_str())); + else MUTEX_DBG(printf("trylock failed on %s\n", name.c_str())); + + return ret; } void Mutex::lock() { pthread_mutex_lock(&mutex); + MUTEX_DBG(printf("lock on %s\n", name.c_str())); } void Mutex::unlock() { + MUTEX_DBG(printf("unlock on %s\n", name.c_str())); pthread_mutex_unlock(&mutex); } |