summaryrefslogtreecommitdiffstats
path: root/threads.h
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-12-20 08:54:51 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-12-20 08:54:51 +0000
commit2eb19201b3f4be01057c1b958a077b5fb2fce107 (patch)
tree067b64859e42ff5ad903f20ec9c22bd3600eabe6 /threads.h
parent02a46ee6b0b7f326dc0affd2caae961e09bf9a3b (diff)
downloadrsyslog-2eb19201b3f4be01057c1b958a077b5fb2fce107.tar.gz
rsyslog-2eb19201b3f4be01057c1b958a077b5fb2fce107.tar.xz
rsyslog-2eb19201b3f4be01057c1b958a077b5fb2fce107.zip
- working on a potential race condition on the new input module interface.
See newsgroup posting for details on the issue: http://groups.google.com/group/comp.programming.threads/msg/330b9675f17 a1ad6 I tried some mutex operations but came to the conclusion that this does not really help. So I have now switched to plain thread cancellation, which so far seems to be OK. Need more practical experience with other input modules to make a final decision. Thus I leave all code in and have just disabled the problematic code.
Diffstat (limited to 'threads.h')
-rw-r--r--threads.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/threads.h b/threads.h
index 51ae52cf..6bf1e3b1 100644
--- a/threads.h
+++ b/threads.h
@@ -33,6 +33,7 @@ typedef enum eTermSyncType {
/* the thread object */
typedef struct thrdInfo {
eTermSyncType_t eTermTool;
+ pthread_mutex_t *mutTermOK; /* Is it ok to terminate that thread now? */
int bIsActive; /* Is thread running? */
int bShallStop; /* set to 1 if the thread should be stopped ? */
rsRetVal (*pUsrThrdMain)(struct thrdInfo*); /* user thread main to be called in new thread */
@@ -67,4 +68,13 @@ void queueDel (msgQueue *q, void **out);
extern int iMainMsgQueueSize;
extern msgQueue *pMsgQueue;
+
+/* macros (replace inline functions) */
+/*TODO: remove these macros once we now we can live without -- rgerhards, 2007-12-20
+ * #define thrdBlockTermination(pThis) {dbgprintf("lock mutex\n"); pthread_mutex_lock((pThis)->mutTermOK) ;}
+ * #define thrdUnblockTermination(pThis) {dbgprintf("unlock mutex\n"); pthread_mutex_unlock((pThis)->mutTermOK) ;}
+ */
+#define thrdBlockTermination(pThis)
+#define thrdUnblockTermination(pThis)
+
#endif /* #ifndef THREADS_H_INCLUDED */