summaryrefslogtreecommitdiffstats
path: root/sync.h
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-12-11 16:41:07 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-12-11 16:41:07 +0000
commit71d69002c6899845b8f5326ab5cf2f5aef691668 (patch)
tree13aeff4e2e4d1bb47da32f3f4d4136fba55926ce /sync.h
parent433ba4b2ae39c2ef7264c4beacea213fd20c2bc5 (diff)
downloadrsyslog-71d69002c6899845b8f5326ab5cf2f5aef691668.tar.gz
rsyslog-71d69002c6899845b8f5326ab5cf2f5aef691668.tar.xz
rsyslog-71d69002c6899845b8f5326ab5cf2f5aef691668.zip
optimized mutex macros
Diffstat (limited to 'sync.h')
-rw-r--r--sync.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/sync.h b/sync.h
index f2b3ae33..8a0210a7 100644
--- a/sync.h
+++ b/sync.h
@@ -33,8 +33,18 @@
#define SYNC_OBJ_TOOL pthread_mutex_t *Sync_mut;
#define SYNC_OBJ_TOOL_INIT(x) SyncObjInit(&((x)->Sync_mut))
#define SYNC_OBJ_TOOL_EXIT(x) SyncObjExit(&((x)->Sync_mut))
+
+/* If we run in non-debug mode, we use inline code for the mutex
+ * operations. If we run in debug mode, we use functions, because they
+ * are better to trace in the callframe.
+ */
+#ifndef NDEBUG
+#define LockObj(x) pthread_mutex_lock((x)->Sync_mut)
+#define UnlockObj(x) pthread_mutex_unlock((x)->Sync_mut)
+#else
#define LockObj(x) lockObj((x)->Sync_mut)
#define UnlockObj(x) unlockObj((x)->Sync_mut)
+#endif
void SyncObjInit(pthread_mutex_t **mut);
void SyncObjExit(pthread_mutex_t **mut);