diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-05-17 18:53:29 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-05-17 18:53:29 (GMT) |
commit | 4f1ea4779be85d8837f3a133b52d3b5aa9e53fda (patch) | |
tree | 401339ab1470b40cccd1bec272ac42427c694d92 /generic | |
parent | 4e12ee1bc4fe5d4c49f614f7e18c6df1c8ea0e40 (diff) | |
parent | f44e7c1795fe27f3f37e692f275545e3fe73ebd6 (diff) | |
download | tcl-4f1ea4779be85d8837f3a133b52d3b5aa9e53fda.zip tcl-4f1ea4779be85d8837f3a133b52d3b5aa9e53fda.tar.gz tcl-4f1ea4779be85d8837f3a133b52d3b5aa9e53fda.tar.bz2 |
TIP #491 implementation: Threading Support: phasing out non-threaded builds
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tcl.h | 10 | ||||
-rw-r--r-- | generic/tclAlloc.c | 6 | ||||
-rw-r--r-- | generic/tclBasic.c | 4 | ||||
-rw-r--r-- | generic/tclCkalloc.c | 2 | ||||
-rw-r--r-- | generic/tclEvent.c | 10 | ||||
-rw-r--r-- | generic/tclIORChan.c | 48 | ||||
-rw-r--r-- | generic/tclIORTrans.c | 38 | ||||
-rw-r--r-- | generic/tclInt.h | 8 | ||||
-rw-r--r-- | generic/tclObj.c | 22 | ||||
-rw-r--r-- | generic/tclPkgConfig.c | 2 | ||||
-rw-r--r-- | generic/tclTest.c | 8 | ||||
-rw-r--r-- | generic/tclThread.c | 20 | ||||
-rw-r--r-- | generic/tclThreadAlloc.c | 2 | ||||
-rw-r--r-- | generic/tclThreadStorage.c | 2 | ||||
-rw-r--r-- | generic/tclThreadTest.c | 2 |
15 files changed, 96 insertions, 88 deletions
diff --git a/generic/tcl.h b/generic/tcl.h index a5f85df..ff82bd6 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -91,6 +91,10 @@ extern "C" { #endif #endif /* !TCL_NO_DEPRECATED */ +#ifndef TCL_THREADS +# define TCL_THREADS 1 +#endif + /* * A special definition used to allow this header file to be included from * windows resource files so that they can obtain version information. @@ -107,7 +111,7 @@ extern "C" { * using threads. */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS #define TCL_DECLARE_MUTEX(name) static Tcl_Mutex name; #else #define TCL_DECLARE_MUTEX(name) @@ -2561,7 +2565,7 @@ EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr); * when compiling without thread support. */ -#ifndef TCL_THREADS +#if defined(TCL_THREADS) && !TCL_THREADS #undef Tcl_MutexLock #define Tcl_MutexLock(mutexPtr) #undef Tcl_MutexUnlock @@ -2574,7 +2578,7 @@ EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr); #define Tcl_ConditionWait(condPtr, mutexPtr, timePtr) #undef Tcl_ConditionFinalize #define Tcl_ConditionFinalize(condPtr) -#endif /* TCL_THREADS */ +#endif /* !TCL_THREADS */ /* *---------------------------------------------------------------------------- diff --git a/generic/tclAlloc.c b/generic/tclAlloc.c index 8a4b1c8..e04e9c6 100644 --- a/generic/tclAlloc.c +++ b/generic/tclAlloc.c @@ -22,7 +22,7 @@ */ #include "tclInt.h" -#if !defined(TCL_THREADS) || !defined(USE_THREAD_ALLOC) +#if (defined(TCL_THREADS) && !TCL_THREADS) || !defined(USE_THREAD_ALLOC) #if USE_TCLALLOC @@ -121,7 +121,7 @@ static struct block bigBlocks={ /* Big blocks aren't suballocated. */ * variable. */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS static Tcl_Mutex *allocMutexPtr; #endif static int allocInit = 0; @@ -171,7 +171,7 @@ TclInitAlloc(void) { if (!allocInit) { allocInit = 1; -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS allocMutexPtr = Tcl_GetAllocMutex(); #endif } diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 2ebed06..e20c1b3 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) && defined(USE_THREAD_ALLOC) +#if (!defined(TCL_THREADS) || 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); -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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 de767f9..e00ac19 100644 --- a/generic/tclCkalloc.c +++ b/generic/tclCkalloc.c @@ -156,7 +156,7 @@ TclInitDbCkalloc(void) if (!ckallocInit) { ckallocInit = 1; ckallocMutexPtr = Tcl_GetAllocMutex(); -#ifndef TCL_THREADS +#if defined(TCL_THREADS) && !TCL_THREADS /* Silence compiler warning */ (void)ckallocMutexPtr; #endif diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 93cf983..f8ad1ae 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -100,7 +100,7 @@ typedef struct ThreadSpecificData { } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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) && defined(USE_THREAD_ALLOC) +#if (!defined(TCL_THREADS) || 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) && defined(USE_THREAD_ALLOC) +#if (!defined(TCL_THREADS) || TCL_THREADS) && defined(USE_THREAD_ALLOC) TclFinalizeThreadAlloc(); #endif @@ -1538,7 +1538,7 @@ Tcl_UpdateObjCmd( return TCL_OK; } -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS /* *---------------------------------------------------------------------- * @@ -1601,7 +1601,7 @@ Tcl_CreateThread( int flags) /* Flags controlling behaviour of the new * thread. */ { -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS ThreadClientData *cdPtr = ckalloc(sizeof(ThreadClientData)); int result; diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index 8e1496d..1553cd0 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); -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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 */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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. */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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)) -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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}"; -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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); -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS rcmPtr = GetThreadReflectedChannelMap(); hPtr = Tcl_CreateHashEntry(&rcmPtr->map, chanPtr->state->channelName, &isNew); @@ -750,7 +750,7 @@ TclChanCreateObjCmd( *---------------------------------------------------------------------- */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS typedef struct { Tcl_Event header; ReflectedChannel *rcPtr; @@ -917,11 +917,11 @@ TclChanPostEventObjCmd( * We have the channel and the events to post. */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS if (rcPtr->owner == rcPtr->thread) { #endif Tcl_NotifyChannel(chan, events); -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS } else { ReflectEvent *ev = ckalloc(sizeof(ReflectEvent)); @@ -1137,7 +1137,7 @@ ReflectClose( * if lost? */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS if (rcPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -1169,7 +1169,7 @@ ReflectClose( * Are we in the correct thread? */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS if (rcPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -1216,7 +1216,7 @@ ReflectClose( Tcl_DeleteHashEntry(hPtr); } } -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS rcmPtr = GetThreadReflectedChannelMap(); hPtr = Tcl_FindHashEntry(&rcmPtr->map, Tcl_GetChannelName(rcPtr->chan)); @@ -1267,7 +1267,7 @@ ReflectInput( * Are we in the correct thread? */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS if (rcPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -1373,7 +1373,7 @@ ReflectOutput( * Are we in the correct thread? */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS if (rcPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -1502,7 +1502,7 @@ ReflectSeekWide( * Are we in the correct thread? */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS if (rcPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -1625,7 +1625,7 @@ ReflectWatch( * Are we in the correct thread? */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS if (rcPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -1683,7 +1683,7 @@ ReflectBlock( * Are we in the correct thread? */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS if (rcPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -1719,7 +1719,7 @@ ReflectBlock( return errorNum; } -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS /* *---------------------------------------------------------------------- * @@ -1789,7 +1789,7 @@ ReflectSetOption( * Are we in the correct thread? */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS if (rcPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -1868,7 +1868,7 @@ ReflectGetOption( * Are we in the correct thread? */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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; -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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; -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS ForwardingResult *resultPtr; ForwardingEvent *evPtr; ForwardParam *paramPtr; @@ -2536,7 +2536,7 @@ DeleteReflectedChannelMap( Tcl_DeleteHashTable(&rcmPtr->map); ckfree(&rcmPtr->map); -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS /* * The origin interpreter for one or more reflected channels is gone. */ @@ -2622,7 +2622,7 @@ DeleteReflectedChannelMap( #endif } -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS /* *---------------------------------------------------------------------- * diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c index fe2e458..03fadd1 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. */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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)) -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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}"; -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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); -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS rtmPtr = GetThreadReflectedTransformMap(); hPtr = Tcl_CreateHashEntry(&rtmPtr->map, TclGetString(rtId), &isNew); Tcl_SetHashValue(hPtr, rtPtr); @@ -911,7 +911,7 @@ ReflectClose( * if lost? */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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)) { -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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)) { -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS if (rtPtr->thread != Tcl_GetCurrentThread()) { Tcl_EventuallyFree(rtPtr, (Tcl_FreeProc *) FreeReflectedTransform); @@ -968,7 +968,7 @@ ReflectClose( * Are we in the correct thread? */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS if (rtPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -1025,7 +1025,7 @@ ReflectClose( * under a channel by deleting the owning thread. */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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; -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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; -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS ForwardingResult *resultPtr; ForwardingEvent *evPtr; ForwardParam *paramPtr; @@ -2182,7 +2182,7 @@ DeleteReflectedTransformMap( Tcl_DeleteHashTable(&rtmPtr->map); ckfree(&rtmPtr->map); -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS /* * The origin interpreter for one or more reflected channels is gone. */ @@ -2254,7 +2254,7 @@ DeleteReflectedTransformMap( #endif /* TCL_THREADS */ } -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS /* *---------------------------------------------------------------------- * @@ -3088,7 +3088,7 @@ TransformRead( * Are we in the correct thread? */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS if (rtPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -3144,7 +3144,7 @@ TransformWrite( * Are we in the correct thread? */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS if (rtPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -3210,7 +3210,7 @@ TransformDrain( * Are we in the correct thread? */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS if (rtPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -3260,7 +3260,7 @@ TransformFlush( * Are we in the correct thread? */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS if (rtPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -3315,7 +3315,7 @@ TransformClear( * Are we in the correct thread? */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS if (rtPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -3347,7 +3347,7 @@ TransformLimit( * Are we in the correct thread? */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS if (rtPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; diff --git a/generic/tclInt.h b/generic/tclInt.h index 8f5d8ba..eb1ae68 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4200,6 +4200,10 @@ typedef const char *TclDTraceStr; } \ } +#if (!defined(TCL_THREADS) || TCL_THREADS) && !defined(USE_THREAD_ALLOC) +# define USE_THREAD_ALLOC 1 +#endif + #if defined(PURIFY) /* @@ -4217,7 +4221,7 @@ typedef const char *TclDTraceStr; #undef USE_THREAD_ALLOC #undef USE_TCLALLOC -#elif defined(TCL_THREADS) && defined(USE_THREAD_ALLOC) +#elif (!defined(TCL_THREADS) || TCL_THREADS) && defined(USE_THREAD_ALLOC) /* * The TCL_THREADS mode is like the regular mode but allocates Tcl_Obj's from @@ -4282,7 +4286,7 @@ MODULE_SCOPE void TclpFreeAllocCache(void *); # define USE_TCLALLOC 0 #endif -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS /* declared in tclObj.c */ MODULE_SCOPE Tcl_Mutex tclObjMutex; #endif diff --git a/generic/tclObj.c b/generic/tclObj.c index 7b9488e..0cd04ef 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -37,7 +37,7 @@ Tcl_Obj *tclFreeObjList = NULL; * TclNewObj macro, however, so must be visible. */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS MODULE_SCOPE Tcl_Mutex tclObjMutex; Tcl_Mutex tclObjMutex; #endif @@ -50,7 +50,7 @@ Tcl_Mutex tclObjMutex; char tclEmptyString = '\0'; -#if defined(TCL_MEM_DEBUG) && defined(TCL_THREADS) +#if (!defined(TCL_THREADS) || 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_MEM_DEBUG) && defined(TCL_THREADS) +#if (!defined(TCL_THREADS) || 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. */ -#ifndef TCL_THREADS +#if defined(TCL_THREADS) && !TCL_THREADS static PendingObjData pendingObjData; #define ObjInitDeletionContext(contextPtr) \ PendingObjData *const contextPtr = &pendingObjData @@ -452,7 +452,7 @@ TclInitObjSubsystem(void) void TclFinalizeThreadObjects(void) { -#if defined(TCL_MEM_DEBUG) && defined(TCL_THREADS) +#if (!defined(TCL_THREADS) || 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_MEM_DEBUG) && defined(TCL_THREADS) +#if (!defined(TCL_THREADS) || 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; -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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); -# ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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"); } -# ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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"); } -# ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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"); } -# ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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 466d535..a456a14 100644 --- a/generic/tclPkgConfig.c +++ b/generic/tclPkgConfig.c @@ -40,7 +40,7 @@ * configuration information. */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS # define CFG_THREADED "1" #else # define CFG_THREADED "0" diff --git a/generic/tclTest.c b/generic/tclTest.c index 2ddb595..b4d249f 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); -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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; } -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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; -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS } else if (strcmp(argv[1], "marklater") == 0) { if (argc != 3) { goto wrongNumArgs; @@ -999,7 +999,7 @@ AsyncHandlerProc( *---------------------------------------------------------------------- */ -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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 198fa6a..a70f1aa 100644 --- a/generic/tclThread.c +++ b/generic/tclThread.c @@ -46,7 +46,7 @@ static void RememberSyncObject(void *objPtr, * table. */ -#ifndef TCL_THREADS +#if defined(TCL_THREADS) && !TCL_THREADS #undef Tcl_MutexLock #undef Tcl_MutexUnlock #undef Tcl_MutexFinalize @@ -79,7 +79,7 @@ Tcl_GetThreadData( int size) /* Size of storage block */ { void *result; -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS /* * Initialize the key for this thread. */ @@ -126,7 +126,7 @@ TclThreadDataKeyGet( Tcl_ThreadDataKey *keyPtr) /* Identifier for the data chunk. */ { -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS return TclThreadStorageKeyGet(keyPtr); #else /* TCL_THREADS */ return *keyPtr; @@ -273,7 +273,7 @@ void Tcl_MutexFinalize( Tcl_Mutex *mutexPtr) { -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS TclpFinalizeMutex(mutexPtr); #endif TclpMasterLock(); @@ -326,7 +326,7 @@ void Tcl_ConditionFinalize( Tcl_Condition *condPtr) { -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS TclpFinalizeCondition(condPtr); #endif TclpMasterLock(); @@ -356,7 +356,7 @@ void TclFinalizeThreadData(int quick) { TclFinalizeThreadDataThread(); -#if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC) +#if (!defined(TCL_THREADS) || TCL_THREADS) && defined(USE_THREAD_ALLOC) if (!quick) { /* * Quick exit principle makes it useless to terminate allocators @@ -389,7 +389,7 @@ TclFinalizeSynchronization(void) int i; void *blockPtr; Tcl_ThreadDataKey *keyPtr; -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS Tcl_Mutex *mutexPtr; Tcl_Condition *condPtr; @@ -413,7 +413,7 @@ TclFinalizeSynchronization(void) keyRecord.max = 0; keyRecord.num = 0; -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS /* * Call thread storage master cleanup. */ @@ -473,12 +473,12 @@ Tcl_ExitThread( int status) { Tcl_FinalizeThread(); -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS TclpThreadExit(status); #endif } -#ifndef TCL_THREADS +#if defined(TCL_THREADS) && !TCL_THREADS /* *---------------------------------------------------------------------- diff --git a/generic/tclThreadAlloc.c b/generic/tclThreadAlloc.c index 8077de4..c8132a5 100644 --- a/generic/tclThreadAlloc.c +++ b/generic/tclThreadAlloc.c @@ -13,7 +13,7 @@ */ #include "tclInt.h" -#if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC) +#if (!defined(TCL_THREADS) || 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 755a461..d925b04 100644 --- a/generic/tclThreadStorage.c +++ b/generic/tclThreadStorage.c @@ -13,7 +13,7 @@ #include "tclInt.h" -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || TCL_THREADS #include <signal.h> /* diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c index a008799..dce15eb 100644 --- a/generic/tclThreadTest.c +++ b/generic/tclThreadTest.c @@ -18,7 +18,7 @@ #endif #include "tclInt.h" -#ifdef TCL_THREADS +#if !defined(TCL_THREADS) || 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 |