From ce025f259b91e61857e70c6690d5db631b5dc747 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 22 May 2018 20:53:24 +0000 Subject: Simplify usage of TCL_THREAD, along the lines of [eeddb0693a950be980a66de3811630a00c7bab54|eeddb0693a]. Suggested by DKF --- generic/tcl.h | 28 +-------------------------- generic/tclAlloc.c | 6 +++--- generic/tclBasic.c | 4 ++-- generic/tclCkalloc.c | 2 +- generic/tclEvent.c | 10 +++++----- generic/tclIORChan.c | 48 +++++++++++++++++++++++----------------------- generic/tclIORTrans.c | 38 ++++++++++++++++++------------------ generic/tclInt.h | 9 ++++++--- generic/tclObj.c | 22 ++++++++++----------- generic/tclPkgConfig.c | 2 +- generic/tclTest.c | 8 ++++---- generic/tclThread.c | 33 +++++++++---------------------- generic/tclThreadAlloc.c | 2 +- generic/tclThreadStorage.c | 2 +- generic/tclThreadTest.c | 2 +- unix/tclEpollNotfy.c | 2 +- unix/tclKqueueNotfy.c | 2 +- unix/tclSelectNotfy.c | 22 ++++++++++----------- unix/tclUnixCompat.c | 14 +++++++------- unix/tclUnixFCmd.c | 2 +- unix/tclUnixInit.c | 2 +- unix/tclUnixNotfy.c | 8 ++++---- unix/tclUnixThrd.c | 28 +++++++++++++-------------- win/tclWinThrd.c | 10 +++++----- 24 files changed, 134 insertions(+), 172 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 7d6226b..de314fa 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -107,15 +107,10 @@ extern "C" { #ifndef RC_INVOKED /* - * Special macro to define mutexes, that doesn't do anything if we are not - * using threads. + * Special macro to define mutexes. */ -#if !defined(TCL_THREADS) || TCL_THREADS #define TCL_DECLARE_MUTEX(name) static Tcl_Mutex name; -#else -#define TCL_DECLARE_MUTEX(name) -#endif /* * Tcl's public routine Tcl_FSSeek() uses the values SEEK_SET, SEEK_CUR, and @@ -2561,27 +2556,6 @@ EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr); /* *---------------------------------------------------------------------------- - * Macros that eliminate the overhead of the thread synchronization functions - * when compiling without thread support. - */ - -#if defined(TCL_THREADS) && !TCL_THREADS -#undef Tcl_MutexLock -#define Tcl_MutexLock(mutexPtr) -#undef Tcl_MutexUnlock -#define Tcl_MutexUnlock(mutexPtr) -#undef Tcl_MutexFinalize -#define Tcl_MutexFinalize(mutexPtr) -#undef Tcl_ConditionNotify -#define Tcl_ConditionNotify(condPtr) -#undef Tcl_ConditionWait -#define Tcl_ConditionWait(condPtr, mutexPtr, timePtr) -#undef Tcl_ConditionFinalize -#define Tcl_ConditionFinalize(condPtr) -#endif /* !TCL_THREADS */ - -/* - *---------------------------------------------------------------------------- * Deprecated Tcl functions: */ diff --git a/generic/tclAlloc.c b/generic/tclAlloc.c index e04e9c6..df1718b 100644 --- a/generic/tclAlloc.c +++ b/generic/tclAlloc.c @@ -22,7 +22,7 @@ */ #include "tclInt.h" -#if (defined(TCL_THREADS) && !TCL_THREADS) || !defined(USE_THREAD_ALLOC) +#if !TCL_THREADS || !defined(USE_THREAD_ALLOC) #if USE_TCLALLOC @@ -121,7 +121,7 @@ static struct block bigBlocks={ /* Big blocks aren't suballocated. */ * variable. */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS static Tcl_Mutex *allocMutexPtr; #endif static int allocInit = 0; @@ -171,7 +171,7 @@ TclInitAlloc(void) { if (!allocInit) { allocInit = 1; -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS allocMutexPtr = Tcl_GetAllocMutex(); #endif } diff --git a/generic/tclBasic.c b/generic/tclBasic.c index e20c1b3..9c2736c 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -749,7 +749,7 @@ Tcl_CreateInterp(void) * cache was already initialised by the call to alloc the interp struct. */ -#if (!defined(TCL_THREADS) || TCL_THREADS) && defined(USE_THREAD_ALLOC) +#if TCL_THREADS && defined(USE_THREAD_ALLOC) iPtr->allocCache = TclpGetAllocCache(); #else iPtr->allocCache = NULL; @@ -964,7 +964,7 @@ Tcl_CreateInterp(void) #endif /* !TCL_NO_DEPRECATED */ TclpSetVariables(interp); -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* * The existence of the "threaded" element of the tcl_platform array * indicates that this particular Tcl shell has been compiled with threads diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c index e00ac19..e3fb98e 100644 --- a/generic/tclCkalloc.c +++ b/generic/tclCkalloc.c @@ -156,7 +156,7 @@ TclInitDbCkalloc(void) if (!ckallocInit) { ckallocInit = 1; ckallocMutexPtr = Tcl_GetAllocMutex(); -#if defined(TCL_THREADS) && !TCL_THREADS +#if !TCL_THREADS /* Silence compiler warning */ (void)ckallocMutexPtr; #endif diff --git a/generic/tclEvent.c b/generic/tclEvent.c index f8ad1ae..913ff0f 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -100,7 +100,7 @@ typedef struct ThreadSpecificData { } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS typedef struct { Tcl_ThreadCreateProc *proc; /* Main() function of the thread */ ClientData clientData; /* The one argument to Main() */ @@ -1043,7 +1043,7 @@ TclInitSubsystems(void) #if USE_TCLALLOC TclInitAlloc(); /* Process wide mutex init */ #endif -#if (!defined(TCL_THREADS) || TCL_THREADS) && defined(USE_THREAD_ALLOC) +#if TCL_THREADS && defined(USE_THREAD_ALLOC) TclInitThreadAlloc(); /* Setup thread allocator caches */ #endif #ifdef TCL_MEM_DEBUG @@ -1220,7 +1220,7 @@ Tcl_Finalize(void) * Close down the thread-specific object allocator. */ -#if (!defined(TCL_THREADS) || TCL_THREADS) && defined(USE_THREAD_ALLOC) +#if TCL_THREADS && defined(USE_THREAD_ALLOC) TclFinalizeThreadAlloc(); #endif @@ -1538,7 +1538,7 @@ Tcl_UpdateObjCmd( return TCL_OK; } -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* *---------------------------------------------------------------------- * @@ -1601,7 +1601,7 @@ Tcl_CreateThread( int flags) /* Flags controlling behaviour of the new * thread. */ { -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS ThreadClientData *cdPtr = ckalloc(sizeof(ThreadClientData)); int result; diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index 1553cd0..354f1fb 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -39,7 +39,7 @@ static int ReflectOutput(ClientData clientData, const char *buf, int toWrite, int *errorCodePtr); static void ReflectWatch(ClientData clientData, int mask); static int ReflectBlock(ClientData clientData, int mode); -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS static void ReflectThread(ClientData clientData, int action); static int ReflectEventRun(Tcl_Event *ev, int flags); static int ReflectEventDelete(Tcl_Event *ev, ClientData cd); @@ -76,7 +76,7 @@ static const Tcl_ChannelType tclRChannelType = { NULL, /* Flush channel. Not used by core. NULL'able */ NULL, /* Handle events. NULL'able */ ReflectSeekWide, /* Move access point (64 bit). NULL'able */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS ReflectThread, /* thread action, tracking owner */ #else NULL, /* thread action */ @@ -97,7 +97,7 @@ typedef struct { * interpreter/thread containing its Tcl * command is gone. */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS Tcl_ThreadId thread; /* Thread the 'interp' belongs to. == Handler thread */ Tcl_ThreadId owner; /* Thread owning the structure. == Channel thread */ #endif @@ -201,7 +201,7 @@ typedef enum { #define NEGIMPL(a,b) #define HAS(x,f) (x & FLAG(f)) -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* * Thread specific types and structures. * @@ -451,7 +451,7 @@ static const char *msg_read_toomuch = "{read delivered more than requested}"; static const char *msg_write_toomuch = "{write wrote more than requested}"; static const char *msg_write_nothing = "{write wrote nothing}"; static const char *msg_seek_beforestart = "{Tried to seek before origin}"; -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS static const char *msg_send_originlost = "{Channel thread lost}"; #endif /* TCL_THREADS */ static const char *msg_send_dstlost = "{Owner lost}"; @@ -706,7 +706,7 @@ TclChanCreateObjCmd( Tcl_Panic("TclChanCreateObjCmd: duplicate channel names"); } Tcl_SetHashValue(hPtr, chan); -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS rcmPtr = GetThreadReflectedChannelMap(); hPtr = Tcl_CreateHashEntry(&rcmPtr->map, chanPtr->state->channelName, &isNew); @@ -750,7 +750,7 @@ TclChanCreateObjCmd( *---------------------------------------------------------------------- */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS typedef struct { Tcl_Event header; ReflectedChannel *rcPtr; @@ -917,11 +917,11 @@ TclChanPostEventObjCmd( * We have the channel and the events to post. */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS if (rcPtr->owner == rcPtr->thread) { #endif Tcl_NotifyChannel(chan, events); -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS } else { ReflectEvent *ev = ckalloc(sizeof(ReflectEvent)); @@ -1137,7 +1137,7 @@ ReflectClose( * if lost? */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS if (rcPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -1169,7 +1169,7 @@ ReflectClose( * Are we in the correct thread? */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS if (rcPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -1216,7 +1216,7 @@ ReflectClose( Tcl_DeleteHashEntry(hPtr); } } -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS rcmPtr = GetThreadReflectedChannelMap(); hPtr = Tcl_FindHashEntry(&rcmPtr->map, Tcl_GetChannelName(rcPtr->chan)); @@ -1267,7 +1267,7 @@ ReflectInput( * Are we in the correct thread? */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS if (rcPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -1373,7 +1373,7 @@ ReflectOutput( * Are we in the correct thread? */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS if (rcPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -1502,7 +1502,7 @@ ReflectSeekWide( * Are we in the correct thread? */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS if (rcPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -1625,7 +1625,7 @@ ReflectWatch( * Are we in the correct thread? */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS if (rcPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -1683,7 +1683,7 @@ ReflectBlock( * Are we in the correct thread? */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS if (rcPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -1719,7 +1719,7 @@ ReflectBlock( return errorNum; } -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* *---------------------------------------------------------------------- * @@ -1789,7 +1789,7 @@ ReflectSetOption( * Are we in the correct thread? */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS if (rcPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -1868,7 +1868,7 @@ ReflectGetOption( * Are we in the correct thread? */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS if (rcPtr->thread != Tcl_GetCurrentThread()) { int opcode; ForwardParam p; @@ -2131,7 +2131,7 @@ NewReflectedChannel( rcPtr->chan = NULL; rcPtr->interp = interp; rcPtr->dead = 0; -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS rcPtr->thread = Tcl_GetCurrentThread(); #endif rcPtr->mode = mode; @@ -2506,7 +2506,7 @@ DeleteReflectedChannelMap( Tcl_HashEntry *hPtr; /* Search variable. */ ReflectedChannel *rcPtr; Tcl_Channel chan; -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS ForwardingResult *resultPtr; ForwardingEvent *evPtr; ForwardParam *paramPtr; @@ -2536,7 +2536,7 @@ DeleteReflectedChannelMap( Tcl_DeleteHashTable(&rcmPtr->map); ckfree(&rcmPtr->map); -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* * The origin interpreter for one or more reflected channels is gone. */ @@ -2622,7 +2622,7 @@ DeleteReflectedChannelMap( #endif } -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* *---------------------------------------------------------------------- * diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c index 03fadd1..1a7b940 100644 --- a/generic/tclIORTrans.c +++ b/generic/tclIORTrans.c @@ -127,7 +127,7 @@ typedef struct { * in the argv, see below. The separate field * gives us direct access, needed when working * with the reflection maps. */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS Tcl_ThreadId thread; /* Thread the 'interp' belongs to. */ #endif @@ -220,7 +220,7 @@ typedef enum { #define NEGIMPL(a,b) #define HAS(x,f) (x & FLAG(f)) -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* * Thread specific types and structures. * @@ -438,7 +438,7 @@ static void DeleteReflectedTransformMap(ClientData clientData, static const char *msg_read_unsup = "{read not supported by Tcl driver}"; static const char *msg_write_unsup = "{write not supported by Tcl driver}"; -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS static const char *msg_send_originlost = "{Channel thread lost}"; static const char *msg_send_dstlost = "{Owner lost}"; #endif /* TCL_THREADS */ @@ -699,7 +699,7 @@ TclChanPushObjCmd( Tcl_Panic("TclChanPushObjCmd: duplicate transformation handle"); } Tcl_SetHashValue(hPtr, rtPtr); -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS rtmPtr = GetThreadReflectedTransformMap(); hPtr = Tcl_CreateHashEntry(&rtmPtr->map, TclGetString(rtId), &isNew); Tcl_SetHashValue(hPtr, rtPtr); @@ -911,7 +911,7 @@ ReflectClose( * if lost? */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS if (rtPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -938,7 +938,7 @@ ReflectClose( if (HAS(rtPtr->methods, METH_DRAIN) && !rtPtr->readIsDrained) { if (!TransformDrain(rtPtr, &errorCode)) { -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS if (rtPtr->thread != Tcl_GetCurrentThread()) { Tcl_EventuallyFree(rtPtr, (Tcl_FreeProc *) FreeReflectedTransform); @@ -952,7 +952,7 @@ ReflectClose( if (HAS(rtPtr->methods, METH_FLUSH)) { if (!TransformFlush(rtPtr, &errorCode, FLUSH_WRITE)) { -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS if (rtPtr->thread != Tcl_GetCurrentThread()) { Tcl_EventuallyFree(rtPtr, (Tcl_FreeProc *) FreeReflectedTransform); @@ -968,7 +968,7 @@ ReflectClose( * Are we in the correct thread? */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS if (rtPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -1025,7 +1025,7 @@ ReflectClose( * under a channel by deleting the owning thread. */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS rtmPtr = GetThreadReflectedTransformMap(); hPtr = Tcl_FindHashEntry(&rtmPtr->map, TclGetString(rtPtr->handle)); if (hPtr) { @@ -1767,7 +1767,7 @@ NewReflectedTransform( rtPtr->chan = NULL; rtPtr->methods = 0; -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS rtPtr->thread = Tcl_GetCurrentThread(); #endif rtPtr->parent = parentChan; @@ -2152,7 +2152,7 @@ DeleteReflectedTransformMap( Tcl_HashSearch hSearch; /* Search variable. */ Tcl_HashEntry *hPtr; /* Search variable. */ ReflectedTransform *rtPtr; -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS ForwardingResult *resultPtr; ForwardingEvent *evPtr; ForwardParam *paramPtr; @@ -2182,7 +2182,7 @@ DeleteReflectedTransformMap( Tcl_DeleteHashTable(&rtmPtr->map); ckfree(&rtmPtr->map); -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* * The origin interpreter for one or more reflected channels is gone. */ @@ -2254,7 +2254,7 @@ DeleteReflectedTransformMap( #endif /* TCL_THREADS */ } -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* *---------------------------------------------------------------------- * @@ -3088,7 +3088,7 @@ TransformRead( * Are we in the correct thread? */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS if (rtPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -3144,7 +3144,7 @@ TransformWrite( * Are we in the correct thread? */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS if (rtPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -3210,7 +3210,7 @@ TransformDrain( * Are we in the correct thread? */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS if (rtPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -3260,7 +3260,7 @@ TransformFlush( * Are we in the correct thread? */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS if (rtPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -3315,7 +3315,7 @@ TransformClear( * Are we in the correct thread? */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS if (rtPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -3347,7 +3347,7 @@ TransformLimit( * Are we in the correct thread? */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS if (rtPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; diff --git a/generic/tclInt.h b/generic/tclInt.h index eb1ae68..a29dae8 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4200,7 +4200,10 @@ typedef const char *TclDTraceStr; } \ } -#if (!defined(TCL_THREADS) || TCL_THREADS) && !defined(USE_THREAD_ALLOC) +#if !defined(TCL_THREADS) +# define TCL_THREADS 1 +#endif +#if TCL_THREADS && !defined(USE_THREAD_ALLOC) # define USE_THREAD_ALLOC 1 #endif @@ -4221,7 +4224,7 @@ typedef const char *TclDTraceStr; #undef USE_THREAD_ALLOC #undef USE_TCLALLOC -#elif (!defined(TCL_THREADS) || TCL_THREADS) && defined(USE_THREAD_ALLOC) +#elif TCL_THREADS && defined(USE_THREAD_ALLOC) /* * The TCL_THREADS mode is like the regular mode but allocates Tcl_Obj's from @@ -4286,7 +4289,7 @@ MODULE_SCOPE void TclpFreeAllocCache(void *); # define USE_TCLALLOC 0 #endif -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* declared in tclObj.c */ MODULE_SCOPE Tcl_Mutex tclObjMutex; #endif diff --git a/generic/tclObj.c b/generic/tclObj.c index 0cd04ef..f93f583 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -37,7 +37,7 @@ Tcl_Obj *tclFreeObjList = NULL; * TclNewObj macro, however, so must be visible. */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS MODULE_SCOPE Tcl_Mutex tclObjMutex; Tcl_Mutex tclObjMutex; #endif @@ -50,7 +50,7 @@ Tcl_Mutex tclObjMutex; char tclEmptyString = '\0'; -#if (!defined(TCL_THREADS) || TCL_THREADS) && defined(TCL_MEM_DEBUG) +#if TCL_THREADS && defined(TCL_MEM_DEBUG) /* * Structure for tracking the source file and line number where a given * Tcl_Obj was allocated. We also track the pointer to the Tcl_Obj itself, @@ -87,7 +87,7 @@ typedef struct { * tclCompile.h for the definition of this * structure, and for references to all * related places in the core. */ -#if (!defined(TCL_THREADS) || TCL_THREADS) && defined(TCL_MEM_DEBUG) +#if TCL_THREADS && defined(TCL_MEM_DEBUG) Tcl_HashTable *objThreadMap;/* Thread local table that is used to check * that a Tcl_Obj was not allocated by some * other thread. */ @@ -156,7 +156,7 @@ typedef struct PendingObjData { /* * Macro to set up the local reference to the deletion context. */ -#if defined(TCL_THREADS) && !TCL_THREADS +#if !TCL_THREADS static PendingObjData pendingObjData; #define ObjInitDeletionContext(contextPtr) \ PendingObjData *const contextPtr = &pendingObjData @@ -452,7 +452,7 @@ TclInitObjSubsystem(void) void TclFinalizeThreadObjects(void) { -#if (!defined(TCL_THREADS) || TCL_THREADS) && defined(TCL_MEM_DEBUG) +#if TCL_THREADS && defined(TCL_MEM_DEBUG) Tcl_HashEntry *hPtr; Tcl_HashSearch hSearch; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); @@ -1009,7 +1009,7 @@ void TclDbDumpActiveObjects( FILE *outFile) { -#if (!defined(TCL_THREADS) || TCL_THREADS) && defined(TCL_MEM_DEBUG) +#if TCL_THREADS && defined(TCL_MEM_DEBUG) Tcl_HashSearch hSearch; Tcl_HashEntry *hPtr; Tcl_HashTable *tablePtr; @@ -1069,7 +1069,7 @@ TclDbInitNewObj( objPtr->length = 0; objPtr->typePtr = NULL; -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* * Add entry to a thread local map used to check if a Tcl_Obj was * allocated by the currently executing thread. @@ -1305,7 +1305,7 @@ TclFreeObj( ObjInitDeletionContext(context); -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* * Check to make sure that the Tcl_Obj was allocated by the current * thread. Don't do this check when shutting down since thread local @@ -3598,7 +3598,7 @@ Tcl_DbIncrRefCount( Tcl_Panic("incrementing refCount of previously disposed object"); } -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* * Check to make sure that the Tcl_Obj was allocated by the current * thread. Don't do this check when shutting down since thread local @@ -3661,7 +3661,7 @@ Tcl_DbDecrRefCount( Tcl_Panic("decrementing refCount of previously disposed object"); } -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* * Check to make sure that the Tcl_Obj was allocated by the current * thread. Don't do this check when shutting down since thread local @@ -3726,7 +3726,7 @@ Tcl_DbIsShared( Tcl_Panic("checking whether previously disposed object is shared"); } -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* * Check to make sure that the Tcl_Obj was allocated by the current * thread. Don't do this check when shutting down since thread local diff --git a/generic/tclPkgConfig.c b/generic/tclPkgConfig.c index a456a14..9e194c8 100644 --- a/generic/tclPkgConfig.c +++ b/generic/tclPkgConfig.c @@ -40,7 +40,7 @@ * configuration information. */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS # define CFG_THREADED "1" #else # define CFG_THREADED "0" diff --git a/generic/tclTest.c b/generic/tclTest.c index b4d249f..ac01ecf 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -161,7 +161,7 @@ static TestChannel *firstDetached; static int AsyncHandlerProc(ClientData clientData, Tcl_Interp *interp, int code); -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS static Tcl_ThreadCreateType AsyncThreadProc(ClientData); #endif static void CleanupTestSetassocdataTests( @@ -722,7 +722,7 @@ Tcltest_Init( if (Procbodytest_Init(interp) != TCL_OK) { return TCL_ERROR; } -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS if (TclThread_Init(interp) != TCL_OK) { return TCL_ERROR; } @@ -902,7 +902,7 @@ TestasyncCmd( Tcl_SetObjResult(interp, Tcl_NewStringObj(argv[3], -1)); Tcl_MutexUnlock(&asyncTestMutex); return code; -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS } else if (strcmp(argv[1], "marklater") == 0) { if (argc != 3) { goto wrongNumArgs; @@ -999,7 +999,7 @@ AsyncHandlerProc( *---------------------------------------------------------------------- */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS static Tcl_ThreadCreateType AsyncThreadProc( ClientData clientData) /* Parameter is the id of a diff --git a/generic/tclThread.c b/generic/tclThread.c index a70f1aa..8def429 100644 --- a/generic/tclThread.c +++ b/generic/tclThread.c @@ -41,21 +41,6 @@ static void RememberSyncObject(void *objPtr, SyncObjRecord *recPtr); /* - * Several functions are #defined to nothing in tcl.h if TCL_THREADS is not - * specified. Here we undo that so the functions are defined in the stubs - * table. - */ - -#if defined(TCL_THREADS) && !TCL_THREADS -#undef Tcl_MutexLock -#undef Tcl_MutexUnlock -#undef Tcl_MutexFinalize -#undef Tcl_ConditionNotify -#undef Tcl_ConditionWait -#undef Tcl_ConditionFinalize -#endif - -/* *---------------------------------------------------------------------- * * Tcl_GetThreadData -- @@ -79,7 +64,7 @@ Tcl_GetThreadData( int size) /* Size of storage block */ { void *result; -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* * Initialize the key for this thread. */ @@ -126,7 +111,7 @@ TclThreadDataKeyGet( Tcl_ThreadDataKey *keyPtr) /* Identifier for the data chunk. */ { -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS return TclThreadStorageKeyGet(keyPtr); #else /* TCL_THREADS */ return *keyPtr; @@ -273,7 +258,7 @@ void Tcl_MutexFinalize( Tcl_Mutex *mutexPtr) { -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS TclpFinalizeMutex(mutexPtr); #endif TclpMasterLock(); @@ -326,7 +311,7 @@ void Tcl_ConditionFinalize( Tcl_Condition *condPtr) { -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS TclpFinalizeCondition(condPtr); #endif TclpMasterLock(); @@ -356,7 +341,7 @@ void TclFinalizeThreadData(int quick) { TclFinalizeThreadDataThread(); -#if (!defined(TCL_THREADS) || TCL_THREADS) && defined(USE_THREAD_ALLOC) +#if TCL_THREADS && defined(USE_THREAD_ALLOC) if (!quick) { /* * Quick exit principle makes it useless to terminate allocators @@ -389,7 +374,7 @@ TclFinalizeSynchronization(void) int i; void *blockPtr; Tcl_ThreadDataKey *keyPtr; -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS Tcl_Mutex *mutexPtr; Tcl_Condition *condPtr; @@ -413,7 +398,7 @@ TclFinalizeSynchronization(void) keyRecord.max = 0; keyRecord.num = 0; -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* * Call thread storage master cleanup. */ @@ -473,12 +458,12 @@ Tcl_ExitThread( int status) { Tcl_FinalizeThread(); -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS TclpThreadExit(status); #endif } -#if defined(TCL_THREADS) && !TCL_THREADS +#if !TCL_THREADS /* *---------------------------------------------------------------------- diff --git a/generic/tclThreadAlloc.c b/generic/tclThreadAlloc.c index c8132a5..3f1abc2 100644 --- a/generic/tclThreadAlloc.c +++ b/generic/tclThreadAlloc.c @@ -13,7 +13,7 @@ */ #include "tclInt.h" -#if (!defined(TCL_THREADS) || TCL_THREADS) && defined(USE_THREAD_ALLOC) +#if TCL_THREADS && defined(USE_THREAD_ALLOC) /* * If range checking is enabled, an additional byte will be allocated to store diff --git a/generic/tclThreadStorage.c b/generic/tclThreadStorage.c index d925b04..b56ec80 100644 --- a/generic/tclThreadStorage.c +++ b/generic/tclThreadStorage.c @@ -13,7 +13,7 @@ #include "tclInt.h" -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS #include /* diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c index dce15eb..3a6fc43 100644 --- a/generic/tclThreadTest.c +++ b/generic/tclThreadTest.c @@ -18,7 +18,7 @@ #endif #include "tclInt.h" -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* * Each thread has an single instance of the following structure. There is one * instance of this structure per thread even if that thread contains multiple diff --git a/unix/tclEpollNotfy.c b/unix/tclEpollNotfy.c index 3059643..b3ee57a 100644 --- a/unix/tclEpollNotfy.c +++ b/unix/tclEpollNotfy.c @@ -12,7 +12,7 @@ * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ -#if defined(NOTIFIER_EPOLL) && (!defined(TCL_THREADS) || TCL_THREADS) +#if defined(NOTIFIER_EPOLL) && TCL_THREADS #define _GNU_SOURCE /* For pipe2(2) */ #include "tclInt.h" diff --git a/unix/tclKqueueNotfy.c b/unix/tclKqueueNotfy.c index 3fddeea..da52d96 100644 --- a/unix/tclKqueueNotfy.c +++ b/unix/tclKqueueNotfy.c @@ -13,7 +13,7 @@ * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ -#if defined(NOTIFIER_KQUEUE) && (!defined(TCL_THREADS) || TCL_THREADS) +#if defined(NOTIFIER_KQUEUE) && TCL_THREADS #include "tclInt.h" #ifndef HAVE_COREFOUNDATION /* Darwin/Mac OS X CoreFoundation notifier is diff --git a/unix/tclSelectNotfy.c b/unix/tclSelectNotfy.c index 3172d6a..58dc742 100644 --- a/unix/tclSelectNotfy.c +++ b/unix/tclSelectNotfy.c @@ -11,7 +11,7 @@ * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ -#if (!defined(NOTIFIER_EPOLL) && !defined(NOTIFIER_KQUEUE)) || (defined(TCL_THREADS) && !TCL_THREADS) +#if (!defined(NOTIFIER_EPOLL) && !defined(NOTIFIER_KQUEUE)) || !TCL_THREADS #include "tclInt.h" #ifndef HAVE_COREFOUNDATION /* Darwin/Mac OS X CoreFoundation notifier is @@ -81,7 +81,7 @@ typedef struct ThreadSpecificData { int numFdBits; /* Number of valid bits in checkMasks (one * more than highest fd for which * Tcl_WatchFile has been called). */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS int onList; /* True if it is in this list */ unsigned int pollState; /* pollState is used to implement a polling * handshake between each thread and the @@ -112,7 +112,7 @@ typedef struct ThreadSpecificData { static Tcl_ThreadDataKey dataKey; -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* * The following static indicates the number of threads that have initialized * notifiers. @@ -193,7 +193,7 @@ static Tcl_ThreadId notifierThread; * Static routines defined in this file. */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS static TCL_NORETURN void NotifierThreadProc(ClientData clientData); #if defined(HAVE_PTHREAD_ATFORK) static int atForkInit = 0; @@ -285,7 +285,7 @@ Tcl_InitNotifier(void) } else { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS tsdPtr->eventReady = 0; /* @@ -370,7 +370,7 @@ Tcl_FinalizeNotifier( tclNotifierHooks.finalizeNotifierProc(clientData); return; } else { -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); pthread_mutex_lock(¬ifierInitMutex); @@ -640,7 +640,7 @@ Tcl_WaitForEvent( FileHandler *filePtr; int mask; Tcl_Time vTime; -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS int waitForFiles; # ifdef __CYGWIN__ MSG msg; @@ -675,7 +675,7 @@ Tcl_WaitForEvent( tclScaleTimeProcPtr(&vTime, tclTimeClientData); timePtr = &vTime; } -#if defined(TCL_THREADS) && !TCL_THREADS +#if !TCL_THREADS timeout.tv_sec = timePtr->sec; timeout.tv_usec = timePtr->usec; timeoutPtr = &timeout; @@ -694,7 +694,7 @@ Tcl_WaitForEvent( #endif /* !TCL_THREADS */ } -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* * Start notifier thread and place this thread on the list of * interested threads, signal the notifier thread, and wait for a @@ -885,14 +885,14 @@ Tcl_WaitForEvent( } filePtr->readyMask = mask; } -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS pthread_mutex_unlock(¬ifierMutex); #endif /* TCL_THREADS */ return 0; } } -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* *---------------------------------------------------------------------- diff --git a/unix/tclUnixCompat.c b/unix/tclUnixCompat.c index 2d2e53b..aa25c6b 100644 --- a/unix/tclUnixCompat.c +++ b/unix/tclUnixCompat.c @@ -47,7 +47,7 @@ * library calls. */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS typedef struct { struct passwd pwd; @@ -182,7 +182,7 @@ struct passwd * TclpGetPwNam( const char *name) { -#if defined(TCL_THREADS) && !TCL_THREADS +#if !TCL_THREADS return getpwnam(name); #else ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); @@ -262,7 +262,7 @@ struct passwd * TclpGetPwUid( uid_t uid) { -#if defined(TCL_THREADS) && !TCL_THREADS +#if !TCL_THREADS return getpwuid(uid); #else ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); @@ -365,7 +365,7 @@ struct group * TclpGetGrNam( const char *name) { -#if defined(TCL_THREADS) && !TCL_THREADS +#if !TCL_THREADS return getgrnam(name); #else ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); @@ -445,7 +445,7 @@ struct group * TclpGetGrGid( gid_t gid) { -#if defined(TCL_THREADS) && !TCL_THREADS +#if !TCL_THREADS return getgrgid(gid); #else ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); @@ -548,7 +548,7 @@ struct hostent * TclpGetHostByName( const char *name) { -#if (defined(TCL_THREADS) && !TCL_THREADS) || defined(HAVE_MTSAFE_GETHOSTBYNAME) +#if !TCL_THREADS || defined(HAVE_MTSAFE_GETHOSTBYNAME) return gethostbyname(name); #else ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); @@ -618,7 +618,7 @@ TclpGetHostByAddr( int length, int type) { -#if (defined(TCL_THREADS) && !TCL_THREADS) || defined(HAVE_MTSAFE_GETHOSTBYADDR) +#if !TCL_THREADS || defined(HAVE_MTSAFE_GETHOSTBYADDR) return gethostbyaddr(addr, length, type); #else ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c index 2b2a613..548e96b 100644 --- a/unix/tclUnixFCmd.c +++ b/unix/tclUnixFCmd.c @@ -256,7 +256,7 @@ Realpath( #endif /* PURIFY */ #ifndef NO_REALPATH -#if defined(__APPLE__) && (!defined(TCL_THREADS) || TCL_THREADS) && \ +#if defined(__APPLE__) && TCL_THREADS && \ defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \ MAC_OS_X_VERSION_MIN_REQUIRED < 1030 /* diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index 78d591a..b6b66da 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -316,7 +316,7 @@ static int MacOSXGetLibraryPath(Tcl_Interp *interp, #endif /* HAVE_COREFOUNDATION */ #if defined(__APPLE__) && (defined(TCL_LOAD_FROM_MEMORY) || ( \ defined(MAC_OS_X_VERSION_MIN_REQUIRED) && ( \ - ((!defined(TCL_THREADS) || TCL_THREADS) && MAC_OS_X_VERSION_MIN_REQUIRED < 1030) || \ + (TCL_THREADS && MAC_OS_X_VERSION_MIN_REQUIRED < 1030) || \ (defined(__LP64__) && MAC_OS_X_VERSION_MIN_REQUIRED < 1050) || \ (defined(HAVE_COREFOUNDATION) && MAC_OS_X_VERSION_MIN_REQUIRED < 1050)\ ))) diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index 6572b39..062d817 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -18,7 +18,7 @@ */ static int FileHandlerEventProc(Tcl_Event *evPtr, int flags); -#if defined(TCL_THREADS) && !TCL_THREADS +#if !TCL_THREADS # undef NOTIFIER_EPOLL # undef NOTIFIER_KQUEUE # define NOTIFIER_SELECT @@ -106,7 +106,7 @@ Tcl_AlertNotifier( return; } else { #ifdef NOTIFIER_SELECT -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS ThreadSpecificData *tsdPtr = clientData; pthread_mutex_lock(¬ifierMutex); @@ -197,7 +197,7 @@ Tcl_ServiceModeHook( return; } else if (mode == TCL_SERVICE_ALL) { #ifdef NOTIFIER_SELECT -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS StartNotifierThread("Tcl_ServiceModeHook"); #endif #endif /* NOTIFIER_SELECT */ @@ -279,7 +279,7 @@ FileHandlerEventProc( } #ifdef NOTIFIER_SELECT -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* *---------------------------------------------------------------------- * diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index 76228a3..6ea258f 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -13,7 +13,7 @@ #include "tclInt.h" -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS #ifndef TCL_NO_DEPRECATED typedef struct { @@ -74,7 +74,7 @@ TclpThreadCreate( int flags) /* Flags controlling behaviour of the new * thread. */ { -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS pthread_attr_t attr; pthread_t theThread; int result; @@ -152,7 +152,7 @@ Tcl_JoinThread( * thread we wait upon will be written into. * May be NULL. */ { -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS int result; unsigned long retcode, *retcodePtr = &retcode; @@ -166,7 +166,7 @@ Tcl_JoinThread( #endif } -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* *---------------------------------------------------------------------- * @@ -210,7 +210,7 @@ TclpThreadExit( Tcl_ThreadId Tcl_GetCurrentThread(void) { -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS return (Tcl_ThreadId) pthread_self(); #else return (Tcl_ThreadId) 0; @@ -239,7 +239,7 @@ Tcl_GetCurrentThread(void) void TclpInitLock(void) { -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS pthread_mutex_lock(&initLock); #endif } @@ -265,7 +265,7 @@ TclpInitLock(void) void TclFinalizeLock(void) { -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* * You do not need to destroy mutexes that were created with the * PTHREAD_MUTEX_INITIALIZER macro. These mutexes do not need any @@ -296,7 +296,7 @@ TclFinalizeLock(void) void TclpInitUnlock(void) { -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS pthread_mutex_unlock(&initLock); #endif } @@ -325,7 +325,7 @@ TclpInitUnlock(void) void TclpMasterLock(void) { -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS pthread_mutex_lock(&masterLock); #endif } @@ -351,7 +351,7 @@ TclpMasterLock(void) void TclpMasterUnlock(void) { -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS pthread_mutex_unlock(&masterLock); #endif } @@ -378,7 +378,7 @@ TclpMasterUnlock(void) Tcl_Mutex * Tcl_GetAllocMutex(void) { -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS pthread_mutex_t **allocLockPtrPtr = &allocLockPtr; return (Tcl_Mutex *) allocLockPtrPtr; #else @@ -386,7 +386,7 @@ Tcl_GetAllocMutex(void) #endif } -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* *---------------------------------------------------------------------- @@ -659,7 +659,7 @@ char * TclpInetNtoa( struct in_addr addr) { -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); unsigned char *b = (unsigned char*) &addr.s_addr; @@ -671,7 +671,7 @@ TclpInetNtoa( } #endif /* TCL_NO_DEPRECATED */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* * Additions by AOL for specialized thread memory allocator. */ diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index 07b6db9..5ea407e 100644 --- a/win/tclWinThrd.c +++ b/win/tclWinThrd.c @@ -41,7 +41,7 @@ static CRITICAL_SECTION initLock; * obvious reasons, cannot use any dyamically allocated storage. */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS static struct Tcl_Mutex_ { CRITICAL_SECTION crit; @@ -76,7 +76,7 @@ static CRITICAL_SECTION joinLock; * The per-thread event and queue pointers. */ -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS typedef struct ThreadSpecificData { HANDLE condEvent; /* Per-thread condition event */ @@ -474,7 +474,7 @@ TclpMasterUnlock(void) Tcl_Mutex * Tcl_GetAllocMutex(void) { -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS if (!allocOnce) { InitializeCriticalSection(&allocLock.crit); allocOnce = 1; @@ -516,7 +516,7 @@ TclFinalizeLock(void) DeleteCriticalSection(&masterLock); initialized = 0; -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS if (allocOnce) { DeleteCriticalSection(&allocLock.crit); allocOnce = 0; @@ -532,7 +532,7 @@ TclFinalizeLock(void) DeleteCriticalSection(&initLock); } -#if !defined(TCL_THREADS) || TCL_THREADS +#if TCL_THREADS /* locally used prototype */ static void FinalizeConditionEvent(ClientData data); -- cgit v0.12