diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-01-30 13:41:12 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-01-30 13:41:12 +0100 |
commit | 82d7abc1f4b03f37ff94c5f184d49502b6cf489b (patch) | |
tree | 545c46fba724c62eab6db2382aa73c91e309a97d /runtime/msg.c | |
parent | 40514075c692195290306cd3928b5ce78f2aa38c (diff) | |
download | rsyslog-82d7abc1f4b03f37ff94c5f184d49502b6cf489b.tar.gz rsyslog-82d7abc1f4b03f37ff94c5f184d49502b6cf489b.tar.xz rsyslog-82d7abc1f4b03f37ff94c5f184d49502b6cf489b.zip |
bugfix: invalid mutex access in msg.c
Diffstat (limited to 'runtime/msg.c')
-rw-r--r-- | runtime/msg.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/runtime/msg.c b/runtime/msg.c index c8dbf2c2..064ed44b 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -188,6 +188,7 @@ static void MsgPrepareEnqueueLockingCase(msg_t *pThis) * rgerhards, 2008-07-14 */ pthread_mutexattr_destroy(&pThis->mutAttr); + pThis->bDoLock = 1; ENDfunc } @@ -197,14 +198,16 @@ static void MsgLockLockingCase(msg_t *pThis) { /* DEV debug only! dbgprintf("MsgLock(0x%lx)\n", (unsigned long) pThis); */ assert(pThis != NULL); - pthread_mutex_lock(&pThis->mut); + if(pThis->bDoLock == 1) /* TODO: this is a testing hack, we should find a way with better performance! -- rgerhards, 2009-01-27 */ + pthread_mutex_lock(&pThis->mut); } static void MsgUnlockLockingCase(msg_t *pThis) { /* DEV debug only! dbgprintf("MsgUnlock(0x%lx)\n", (unsigned long) pThis); */ assert(pThis != NULL); - pthread_mutex_unlock(&pThis->mut); + if(pThis->bDoLock == 1) /* TODO: this is a testing hack, we should find a way with better performance! -- rgerhards, 2009-01-27 */ + pthread_mutex_unlock(&pThis->mut); } /* delete the mutex object on message destruction (locking case) |