summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-01-29 12:05:39 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2009-01-29 12:05:39 +0100
commit06f211d2308b723394a18521d2da89f3e67b2b24 (patch)
treeae0f3a9c9ccc2581c4c680545cb660dd2a32bd3b
parent14d5cc7f55ffc7980c0bb73f50b53da175271358 (diff)
parentead2c355e3261f98817ccd52bc3644103140e824 (diff)
downloadrsyslog-06f211d2308b723394a18521d2da89f3e67b2b24.tar.gz
rsyslog-06f211d2308b723394a18521d2da89f3e67b2b24.tar.xz
rsyslog-06f211d2308b723394a18521d2da89f3e67b2b24.zip
Merge branch 'drd-testing'
-rw-r--r--runtime/msg.c9
-rw-r--r--runtime/msg.h1
-rw-r--r--tools/syslogd.c1
3 files changed, 9 insertions, 2 deletions
diff --git a/runtime/msg.c b/runtime/msg.c
index cf291b5d..457a592a 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -190,6 +190,7 @@ static void MsgPrepareEnqueueLockingCase(msg_t *pThis)
* rgerhards, 2008-07-14
*/
pthread_mutexattr_destroy(&pThis->mutAttr);
+ pThis->bDoLock = 1;
ENDfunc
}
@@ -199,14 +200,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)
@@ -744,6 +747,7 @@ char *getMSG(msg_t *pM)
char *getPRI(msg_t *pM)
{
int pri;
+ BEGINfunc
if(pM == NULL)
return "";
@@ -763,6 +767,7 @@ char *getPRI(msg_t *pM)
}
MsgUnlock(pM);
+ ENDfunc
return (char*)pM->pszPRI;
}
diff --git a/runtime/msg.h b/runtime/msg.h
index d98111a8..c8350626 100644
--- a/runtime/msg.h
+++ b/runtime/msg.h
@@ -51,6 +51,7 @@
struct msg {
BEGINobjInstance; /* Data to implement generic object - MUST be the first data element! */
pthread_mutexattr_t mutAttr;
+short bDoLock; /* use the mutex? */
pthread_mutex_t mut;
flowControl_t flowCtlType; /**< type of flow control we can apply, for enqueueing, needs not to be persisted because
once data has entered the queue, this property is no longer needed. */
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 76b107e8..95f343d8 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -2433,6 +2433,7 @@ init(void)
ABORT_FINALIZE(RS_RET_VALIDATION_RUN);
/* switch the message object to threaded operation, if necessary */
+/* TODO:XXX: I think we must do this also if we have action queues! -- rgerhards, 2009-01-26 */
if(MainMsgQueType == QUEUETYPE_DIRECT || iMainMsgQueueNumWorkers > 1) {
MsgEnableThreadSafety();
}