From 2eb19201b3f4be01057c1b958a077b5fb2fce107 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 20 Dec 2007 08:54:51 +0000 Subject: - 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. --- threads.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'threads.h') 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 */ -- cgit