Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch windows-thread-join Excluding Merge-Ins
This is equivalent to a diff from 20891426a8 to 9c9f39bc30
|
2023-06-11
| ||
| 07:29 | Merge trunk [20891426a8]. check-in: 56d7f41983 user: pooryorick tags: trunk-encodingdefaultstrict | |
|
2023-05-04
| ||
| 04:48 | Better fallback on list reallocation failure check-in: 66350977dd user: apnadkarni tags: trunk, main | |
|
2023-05-03
| ||
| 16:12 | Merge 9.0. Further Makefile tweaks Leaf check-in: 9c9f39bc30 user: jan.nijtmans tags: windows-thread-join | |
| 15:59 | Merge 8.7 check-in: 20891426a8 user: jan.nijtmans tags: trunk, main | |
| 15:51 | Backport "Comments only. Fix blatantly obsolete ones". And a few more improvements from the same fil... check-in: 797753b302 user: jan.nijtmans tags: core-8-branch | |
| 15:18 | Removed the bug specific test constraint from the tests related to [0306a5563c] because the bug is ... check-in: 1c4a696c6b user: pointsman tags: trunk, main | |
|
2023-04-03
| ||
| 07:41 | Windows Threads are joinable check-in: af4d891ecb user: mchn1350 tags: windows-thread-join | |
Changes to doc/Thread.3.
| ︙ | ︙ | |||
103 104 105 106 107 108 109 | Using the second value marks the new thread as \fIjoinable\fR. This means that another thread can wait for the such marked thread to exit and join it. .PP Restrictions: On some UNIX systems the pthread-library does not contain the functionality to specify the stack size of a thread. The specified value for the stack size is ignored on these systems. | < < | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | Using the second value marks the new thread as \fIjoinable\fR. This means that another thread can wait for the such marked thread to exit and join it. .PP Restrictions: On some UNIX systems the pthread-library does not contain the functionality to specify the stack size of a thread. The specified value for the stack size is ignored on these systems. .PP Tcl provides the \fBTcl_ExitThread\fR and \fBTcl_FinalizeThread\fR functions for terminating threads and invoking optional per-thread exit handlers. See the \fBTcl_Exit\fR page for more information on these procedures. .PP The \fBTcl_JoinThread\fR function is provided to allow threads to wait |
| ︙ | ︙ | |||
154 155 156 157 158 159 160 | This macro assures correct mutex handling even when the core is compiled without threads enabled. .PP A condition variable is used as a signaling mechanism: a thread can lock a mutex and then wait on a condition variable with \fBTcl_ConditionWait\fR. This atomically releases the mutex lock and blocks the waiting thread until another thread calls | | | | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | This macro assures correct mutex handling even when the core is compiled without threads enabled. .PP A condition variable is used as a signaling mechanism: a thread can lock a mutex and then wait on a condition variable with \fBTcl_ConditionWait\fR. This atomically releases the mutex lock and blocks the waiting thread until another thread calls \fBTcl_ConditionNotify\fR. The caller of \fBTcl_ConditionNotify\fR may have the associated mutex held by previously calling \fBTcl_MutexLock\fR, but this tends to produce more thread context switches. Notifying the condition variable unblocks all threads waiting on the condition variable, but they do not proceed until the mutex is released with \fBTcl_MutexUnlock\fR. The implementation of \fBTcl_ConditionWait\fR automatically locks the mutex before returning. .PP The caller of \fBTcl_ConditionWait\fR should be prepared for spurious notifications by calling \fBTcl_ConditionWait\fR within a while loop |
| ︙ | ︙ |
Changes to generic/tclInt.h.
| ︙ | ︙ | |||
3231 3232 3233 3234 3235 3236 3237 | int forceRelative); MODULE_SCOPE int MakeTildeRelativePath(Tcl_Interp *interp, const char *user, const char *subPath, Tcl_DString *dsPtr); MODULE_SCOPE Tcl_Obj * TclGetHomeDirObj(Tcl_Interp *interp, const char *user); MODULE_SCOPE Tcl_Obj * TclResolveTildePath(Tcl_Interp *interp, Tcl_Obj *pathObj); MODULE_SCOPE Tcl_Obj * TclResolveTildePathList(Tcl_Obj *pathsObj); | < | 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 | int forceRelative); MODULE_SCOPE int MakeTildeRelativePath(Tcl_Interp *interp, const char *user, const char *subPath, Tcl_DString *dsPtr); MODULE_SCOPE Tcl_Obj * TclGetHomeDirObj(Tcl_Interp *interp, const char *user); MODULE_SCOPE Tcl_Obj * TclResolveTildePath(Tcl_Interp *interp, Tcl_Obj *pathObj); MODULE_SCOPE Tcl_Obj * TclResolveTildePathList(Tcl_Obj *pathsObj); MODULE_SCOPE void TclLimitRemoveAllHandlers(Tcl_Interp *interp); MODULE_SCOPE Tcl_Obj * TclLindexList(Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Obj *argPtr); MODULE_SCOPE Tcl_Obj * TclLindexFlat(Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Size indexCount, Tcl_Obj *const indexArray[]); /* TIP #280 */ MODULE_SCOPE void TclListLines(Tcl_Obj *listObj, Tcl_Size line, int n, |
| ︙ | ︙ | |||
3359 3360 3361 3362 3363 3364 3365 | Tcl_DString *linkPtr); MODULE_SCOPE void TclpSetVariables(Tcl_Interp *interp); MODULE_SCOPE void * TclThreadStorageKeyGet(Tcl_ThreadDataKey *keyPtr); MODULE_SCOPE void TclThreadStorageKeySet(Tcl_ThreadDataKey *keyPtr, void *data); MODULE_SCOPE TCL_NORETURN void TclpThreadExit(int status); MODULE_SCOPE void TclRememberCondition(Tcl_Condition *mutex); | < < | 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 | Tcl_DString *linkPtr); MODULE_SCOPE void TclpSetVariables(Tcl_Interp *interp); MODULE_SCOPE void * TclThreadStorageKeyGet(Tcl_ThreadDataKey *keyPtr); MODULE_SCOPE void TclThreadStorageKeySet(Tcl_ThreadDataKey *keyPtr, void *data); MODULE_SCOPE TCL_NORETURN void TclpThreadExit(int status); MODULE_SCOPE void TclRememberCondition(Tcl_Condition *mutex); MODULE_SCOPE void TclRememberMutex(Tcl_Mutex *mutex); MODULE_SCOPE void TclRemoveScriptLimitCallbacks(Tcl_Interp *interp); MODULE_SCOPE int TclReToGlob(Tcl_Interp *interp, const char *reStr, Tcl_Size reStrLen, Tcl_DString *dsPtr, int *flagsPtr, int *quantifiersFoundPtr); MODULE_SCOPE Tcl_Size TclScanElement(const char *string, Tcl_Size length, char *flagPtr); MODULE_SCOPE void TclSetBgErrorHandler(Tcl_Interp *interp, Tcl_Obj *cmdPrefix); MODULE_SCOPE void TclSetBignumInternalRep(Tcl_Obj *objPtr, void *bignumValue); MODULE_SCOPE int TclSetBooleanFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); MODULE_SCOPE void TclSetCmdNameObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Command *cmdPtr); MODULE_SCOPE void TclSetDuplicateObj(Tcl_Obj *dupPtr, Tcl_Obj *objPtr); MODULE_SCOPE void TclSetProcessGlobalValue(ProcessGlobalValue *pgvPtr, Tcl_Obj *newValue, Tcl_Encoding encoding); MODULE_SCOPE void TclSpellFix(Tcl_Interp *interp, Tcl_Obj *const *objv, Tcl_Size objc, Tcl_Size subIdx, Tcl_Obj *bad, Tcl_Obj *fix); MODULE_SCOPE void * TclStackRealloc(Tcl_Interp *interp, void *ptr, Tcl_Size numBytes); typedef int (*memCmpFn_t)(const void*, const void*, size_t); MODULE_SCOPE int TclStringCmp(Tcl_Obj *value1Ptr, Tcl_Obj *value2Ptr, |
| ︙ | ︙ |
Deleted generic/tclThreadJoin.c.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Changes to macosx/Tcl.xcodeproj/project.pbxproj.
| ︙ | ︙ | |||
82 83 84 85 86 87 88 |
F96D45C408F272BC004A47F5 /* tclStubInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2508F272A7004A47F5 /* tclStubInit.c */; };
F96D45C508F272BC004A47F5 /* tclStubLib.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2608F272A7004A47F5 /* tclStubLib.c */; };
F96D45C608F272BC004A47F5 /* tclTest.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2708F272A7004A47F5 /* tclTest.c */; };
F96D45C708F272BC004A47F5 /* tclTestObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2808F272A7004A47F5 /* tclTestObj.c */; };
F96D45C808F272BC004A47F5 /* tclTestProcBodyObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2908F272A7004A47F5 /* tclTestProcBodyObj.c */; };
F96D45C908F272BC004A47F5 /* tclThread.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2A08F272A7004A47F5 /* tclThread.c */; };
F96D45CA08F272BC004A47F5 /* tclThreadAlloc.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2B08F272A7004A47F5 /* tclThreadAlloc.c */; };
| < | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
F96D45C408F272BC004A47F5 /* tclStubInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2508F272A7004A47F5 /* tclStubInit.c */; };
F96D45C508F272BC004A47F5 /* tclStubLib.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2608F272A7004A47F5 /* tclStubLib.c */; };
F96D45C608F272BC004A47F5 /* tclTest.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2708F272A7004A47F5 /* tclTest.c */; };
F96D45C708F272BC004A47F5 /* tclTestObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2808F272A7004A47F5 /* tclTestObj.c */; };
F96D45C808F272BC004A47F5 /* tclTestProcBodyObj.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2908F272A7004A47F5 /* tclTestProcBodyObj.c */; };
F96D45C908F272BC004A47F5 /* tclThread.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2A08F272A7004A47F5 /* tclThread.c */; };
F96D45CA08F272BC004A47F5 /* tclThreadAlloc.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2B08F272A7004A47F5 /* tclThreadAlloc.c */; };
F96D45CC08F272BC004A47F5 /* tclThreadStorage.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2D08F272A7004A47F5 /* tclThreadStorage.c */; };
F96D45CD08F272BC004A47F5 /* tclThreadTest.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2E08F272A7004A47F5 /* tclThreadTest.c */; };
F96D45CE08F272BC004A47F5 /* tclTimer.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F2F08F272A7004A47F5 /* tclTimer.c */; };
F96D45D008F272BC004A47F5 /* tclTomMathInterface.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F3108F272A7004A47F5 /* tclTomMathInterface.c */; };
F96D45D108F272BC004A47F5 /* tclTrace.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F3208F272A7004A47F5 /* tclTrace.c */; };
F96D45D308F272BC004A47F5 /* tclUtf.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F3408F272A7004A47F5 /* tclUtf.c */; };
F96D45D408F272BC004A47F5 /* tclUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D3F3508F272A7004A47F5 /* tclUtil.c */; };
|
| ︙ | ︙ | |||
518 519 520 521 522 523 524 |
F96D3F2508F272A7004A47F5 /* tclStubInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclStubInit.c; sourceTree = "<group>"; };
F96D3F2608F272A7004A47F5 /* tclStubLib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclStubLib.c; sourceTree = "<group>"; };
F96D3F2708F272A7004A47F5 /* tclTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclTest.c; sourceTree = "<group>"; };
F96D3F2808F272A7004A47F5 /* tclTestObj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclTestObj.c; sourceTree = "<group>"; };
F96D3F2908F272A7004A47F5 /* tclTestProcBodyObj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclTestProcBodyObj.c; sourceTree = "<group>"; };
F96D3F2A08F272A7004A47F5 /* tclThread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclThread.c; sourceTree = "<group>"; };
F96D3F2B08F272A7004A47F5 /* tclThreadAlloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclThreadAlloc.c; sourceTree = "<group>"; };
| < | 517 518 519 520 521 522 523 524 525 526 527 528 529 530 |
F96D3F2508F272A7004A47F5 /* tclStubInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclStubInit.c; sourceTree = "<group>"; };
F96D3F2608F272A7004A47F5 /* tclStubLib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclStubLib.c; sourceTree = "<group>"; };
F96D3F2708F272A7004A47F5 /* tclTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclTest.c; sourceTree = "<group>"; };
F96D3F2808F272A7004A47F5 /* tclTestObj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclTestObj.c; sourceTree = "<group>"; };
F96D3F2908F272A7004A47F5 /* tclTestProcBodyObj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclTestProcBodyObj.c; sourceTree = "<group>"; };
F96D3F2A08F272A7004A47F5 /* tclThread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclThread.c; sourceTree = "<group>"; };
F96D3F2B08F272A7004A47F5 /* tclThreadAlloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclThreadAlloc.c; sourceTree = "<group>"; };
F96D3F2D08F272A7004A47F5 /* tclThreadStorage.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclThreadStorage.c; sourceTree = "<group>"; };
F96D3F2E08F272A7004A47F5 /* tclThreadTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclThreadTest.c; sourceTree = "<group>"; };
F96D3F2F08F272A7004A47F5 /* tclTimer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclTimer.c; sourceTree = "<group>"; };
F96D3F3008F272A7004A47F5 /* tclTomMath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclTomMath.h; sourceTree = "<group>"; };
F96D3F3108F272A7004A47F5 /* tclTomMathInterface.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclTomMathInterface.c; sourceTree = "<group>"; };
F96D3F3208F272A7004A47F5 /* tclTrace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclTrace.c; sourceTree = "<group>"; };
F96D3F3308F272A7004A47F5 /* tclUniData.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUniData.c; sourceTree = "<group>"; };
|
| ︙ | ︙ | |||
1293 1294 1295 1296 1297 1298 1299 | F96D3F2508F272A7004A47F5 /* tclStubInit.c */, F96D3F2608F272A7004A47F5 /* tclStubLib.c */, F96D3F2708F272A7004A47F5 /* tclTest.c */, F96D3F2808F272A7004A47F5 /* tclTestObj.c */, F96D3F2908F272A7004A47F5 /* tclTestProcBodyObj.c */, F96D3F2A08F272A7004A47F5 /* tclThread.c */, F96D3F2B08F272A7004A47F5 /* tclThreadAlloc.c */, | < | 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 | F96D3F2508F272A7004A47F5 /* tclStubInit.c */, F96D3F2608F272A7004A47F5 /* tclStubLib.c */, F96D3F2708F272A7004A47F5 /* tclTest.c */, F96D3F2808F272A7004A47F5 /* tclTestObj.c */, F96D3F2908F272A7004A47F5 /* tclTestProcBodyObj.c */, F96D3F2A08F272A7004A47F5 /* tclThread.c */, F96D3F2B08F272A7004A47F5 /* tclThreadAlloc.c */, F96D3F2D08F272A7004A47F5 /* tclThreadStorage.c */, F96D3F2E08F272A7004A47F5 /* tclThreadTest.c */, F96D3F2F08F272A7004A47F5 /* tclTimer.c */, F9903CAF094FAADA004613E9 /* tclTomMath.decls */, F96D3F3008F272A7004A47F5 /* tclTomMath.h */, F9903CB0094FAADA004613E9 /* tclTomMathDecls.h */, F96D3F3108F272A7004A47F5 /* tclTomMathInterface.c */, |
| ︙ | ︙ | |||
1996 1997 1998 1999 2000 2001 2002 | F96D45C408F272BC004A47F5 /* tclStubInit.c in Sources */, F96D45C508F272BC004A47F5 /* tclStubLib.c in Sources */, F96D45C608F272BC004A47F5 /* tclTest.c in Sources */, F96D45C708F272BC004A47F5 /* tclTestObj.c in Sources */, F96D45C808F272BC004A47F5 /* tclTestProcBodyObj.c in Sources */, F96D45C908F272BC004A47F5 /* tclThread.c in Sources */, F96D45CA08F272BC004A47F5 /* tclThreadAlloc.c in Sources */, | < | 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 | F96D45C408F272BC004A47F5 /* tclStubInit.c in Sources */, F96D45C508F272BC004A47F5 /* tclStubLib.c in Sources */, F96D45C608F272BC004A47F5 /* tclTest.c in Sources */, F96D45C708F272BC004A47F5 /* tclTestObj.c in Sources */, F96D45C808F272BC004A47F5 /* tclTestProcBodyObj.c in Sources */, F96D45C908F272BC004A47F5 /* tclThread.c in Sources */, F96D45CA08F272BC004A47F5 /* tclThreadAlloc.c in Sources */, F96D45CC08F272BC004A47F5 /* tclThreadStorage.c in Sources */, F96D45CD08F272BC004A47F5 /* tclThreadTest.c in Sources */, F96D45CE08F272BC004A47F5 /* tclTimer.c in Sources */, F96D45D008F272BC004A47F5 /* tclTomMathInterface.c in Sources */, F96D45D108F272BC004A47F5 /* tclTrace.c in Sources */, F96D45D308F272BC004A47F5 /* tclUtf.c in Sources */, F96D45D408F272BC004A47F5 /* tclUtil.c in Sources */, |
| ︙ | ︙ |
Changes to unix/Makefile.in.
| ︙ | ︙ | |||
310 311 312 313 314 315 316 | tclLink.o tclListObj.o \ tclLiteral.o tclLoad.o tclMain.o tclNamesp.o tclNotify.o \ tclObj.o tclOptimize.o tclPanic.o tclParse.o tclPathObj.o tclPipe.o \ tclPkg.o tclPkgConfig.o tclPosixStr.o \ tclPreserve.o tclProc.o tclProcess.o tclRegexp.o \ tclResolve.o tclResult.o tclScan.o tclStringObj.o \ tclStrToD.o tclThread.o \ | | | 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | tclLink.o tclListObj.o \ tclLiteral.o tclLoad.o tclMain.o tclNamesp.o tclNotify.o \ tclObj.o tclOptimize.o tclPanic.o tclParse.o tclPathObj.o tclPipe.o \ tclPkg.o tclPkgConfig.o tclPosixStr.o \ tclPreserve.o tclProc.o tclProcess.o tclRegexp.o \ tclResolve.o tclResult.o tclScan.o tclStringObj.o \ tclStrToD.o tclThread.o \ tclThreadAlloc.o tclThreadStorage.o tclStubInit.o \ tclTimer.o tclTrace.o tclUtf.o tclUtil.o tclVar.o tclZlib.o \ tclTomMathInterface.o tclZipfs.o OO_OBJS = tclOO.o tclOOBasic.o tclOOCall.o tclOODefineCmds.o tclOOInfo.o \ tclOOMethod.o tclOOStubInit.o TOMMATH_OBJS = bn_s_mp_reverse.o bn_s_mp_mul_digs_fast.o \ |
| ︙ | ︙ | |||
468 469 470 471 472 473 474 | $(GENERIC_DIR)/tclStringObj.c \ $(GENERIC_DIR)/tclStrToD.c \ $(GENERIC_DIR)/tclTest.c \ $(GENERIC_DIR)/tclTestObj.c \ $(GENERIC_DIR)/tclTestProcBodyObj.c \ $(GENERIC_DIR)/tclThread.c \ $(GENERIC_DIR)/tclThreadAlloc.c \ | < | 468 469 470 471 472 473 474 475 476 477 478 479 480 481 | $(GENERIC_DIR)/tclStringObj.c \ $(GENERIC_DIR)/tclStrToD.c \ $(GENERIC_DIR)/tclTest.c \ $(GENERIC_DIR)/tclTestObj.c \ $(GENERIC_DIR)/tclTestProcBodyObj.c \ $(GENERIC_DIR)/tclThread.c \ $(GENERIC_DIR)/tclThreadAlloc.c \ $(GENERIC_DIR)/tclThreadStorage.c \ $(GENERIC_DIR)/tclTimer.c \ $(GENERIC_DIR)/tclTrace.c \ $(GENERIC_DIR)/tclUtil.c \ $(GENERIC_DIR)/tclVar.c \ $(GENERIC_DIR)/tclAssembly.c \ $(GENERIC_DIR)/tclZlib.c \ |
| ︙ | ︙ | |||
1570 1571 1572 1573 1574 1575 1576 | tclThread.o: $(GENERIC_DIR)/tclThread.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclThread.c tclThreadAlloc.o: $(GENERIC_DIR)/tclThreadAlloc.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclThreadAlloc.c | < < < | 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 | tclThread.o: $(GENERIC_DIR)/tclThread.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclThread.c tclThreadAlloc.o: $(GENERIC_DIR)/tclThreadAlloc.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclThreadAlloc.c tclThreadStorage.o: $(GENERIC_DIR)/tclThreadStorage.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclThreadStorage.c tclThreadTest.o: $(GENERIC_DIR)/tclThreadTest.c $(CC) -c $(APP_CC_SWITCHES) $(GENERIC_DIR)/tclThreadTest.c tclTomMathInterface.o: $(GENERIC_DIR)/tclTomMathInterface.c $(MATHHDRS) |
| ︙ | ︙ |
Changes to win/Makefile.in.
| ︙ | ︙ | |||
350 351 352 353 354 355 356 | tclResult.$(OBJEXT) \ tclScan.$(OBJEXT) \ tclStringObj.$(OBJEXT) \ tclStrToD.$(OBJEXT) \ tclStubInit.$(OBJEXT) \ tclThread.$(OBJEXT) \ tclThreadAlloc.$(OBJEXT) \ | < | 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | tclResult.$(OBJEXT) \ tclScan.$(OBJEXT) \ tclStringObj.$(OBJEXT) \ tclStrToD.$(OBJEXT) \ tclStubInit.$(OBJEXT) \ tclThread.$(OBJEXT) \ tclThreadAlloc.$(OBJEXT) \ tclThreadStorage.$(OBJEXT) \ tclTimer.$(OBJEXT) \ tclTomMathInterface.$(OBJEXT) \ tclTrace.$(OBJEXT) \ tclUtf.$(OBJEXT) \ tclUtil.$(OBJEXT) \ tclVar.$(OBJEXT) \ |
| ︙ | ︙ |
Changes to win/makefile.vc.
| ︙ | ︙ | |||
306 307 308 309 310 311 312 | $(TMP_DIR)\tclResult.obj \ $(TMP_DIR)\tclScan.obj \ $(TMP_DIR)\tclStringObj.obj \ $(TMP_DIR)\tclStrToD.obj \ $(TMP_DIR)\tclStubInit.obj \ $(TMP_DIR)\tclThread.obj \ $(TMP_DIR)\tclThreadAlloc.obj \ | < | 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | $(TMP_DIR)\tclResult.obj \ $(TMP_DIR)\tclScan.obj \ $(TMP_DIR)\tclStringObj.obj \ $(TMP_DIR)\tclStrToD.obj \ $(TMP_DIR)\tclStubInit.obj \ $(TMP_DIR)\tclThread.obj \ $(TMP_DIR)\tclThreadAlloc.obj \ $(TMP_DIR)\tclThreadStorage.obj \ $(TMP_DIR)\tclTimer.obj \ $(TMP_DIR)\tclTomMathInterface.obj \ $(TMP_DIR)\tclTrace.obj \ $(TMP_DIR)\tclUtf.obj \ $(TMP_DIR)\tclUtil.obj \ $(TMP_DIR)\tclVar.obj \ |
| ︙ | ︙ |
Changes to win/tcl.dsp.
| ︙ | ︙ | |||
1314 1315 1316 1317 1318 1319 1320 | SOURCE=..\generic\tclTestProcBodyObj.c # End Source File # Begin Source File SOURCE=..\generic\tclThread.c # End Source File | < < < < | 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 | SOURCE=..\generic\tclTestProcBodyObj.c # End Source File # Begin Source File SOURCE=..\generic\tclThread.c # End Source File # Begin Source File SOURCE=..\generic\tclThreadTest.c # End Source File # Begin Source File SOURCE=..\generic\tclTimer.c |
| ︙ | ︙ |
Changes to win/tclWinThrd.c.
| ︙ | ︙ | |||
17 18 19 20 21 22 23 | #ifndef _MCW_EM # define _MCW_EM 0x0008001F /* Error masks */ # define _MCW_RC 0x00000300 /* Rounding */ # define _MCW_PC 0x00030000 /* Precision */ _CRTIMP unsigned int __cdecl _controlfp (unsigned int unNew, unsigned int unMask); #endif | > > > > | | | | < | < | | | | | > > > | | | | | | | | < < < < < < < | < | < < < < < < < < < < < | < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < | < | < < < < < | < < < < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
#ifndef _MCW_EM
# define _MCW_EM 0x0008001F /* Error masks */
# define _MCW_RC 0x00000300 /* Rounding */
# define _MCW_PC 0x00030000 /* Precision */
_CRTIMP unsigned int __cdecl _controlfp (unsigned int unNew, unsigned int unMask);
#endif
static struct tclWinGlobals {
INIT_ONCE init_once; /* must be first member,
because of static initialziation */
/*
* This is the global lock used to serialize access to other serialization
* data structures.
*/
CRITICAL_SECTION globalLock;
/*
* This is the global lock used to serialize initialization and finalization
* of Tcl as a whole.
*/
CRITICAL_SECTION initLock;
/* holds the TLS key for the Tcl Thread_ID */
DWORD tls_thread_id;
/*
* allocLock is used by Tcl's version of malloc for synchronization. For
* obvious reasons, cannot use any dyamically allocated storage.
*/
#if TCL_THREADS
struct Tcl_Mutex_ {
CRITICAL_SECTION crit;
} allocLock;
Tcl_Mutex allocLockPtr;
#endif /* TCL_THREADS */
} TclWinGlobals = {
INIT_ONCE_STATIC_INIT
};
#if TCL_THREADS
typedef struct Tcl_Condition_ {
CONDITION_VARIABLE cv;
} WinCondition;
#endif /* TCL_THREADS */
/*
* The per thread data passed from TclpThreadCreate
* to TclWinThreadStart.
*/
typedef struct {
LPTHREAD_START_ROUTINE lpStartAddress; /* Original startup routine */
LPVOID lpParameter; /* Original startup data */
unsigned int fpControl; /* Floating point control word from the
* main thread */
HANDLE tHandle; /* used to wait on thread completion */
# if defined(_MSC_VER) || defined(__MSVCRT__)
unsigned
# else
DWORD
# endif
thread_id; /* initialized but unused,
possibly useful for debugging */
} WinThread;
/* assuming alignment constraints result in lsb being constant 0 */
# define TCL_WIN_THREAD_JOIN_FLAG ((size_t) 1 << 0)
# define TCL_WIN_THREAD_ID(PTR, JOINABLE)\
((Tcl_ThreadId) ((sizeof ((PTR) - (WinThread *) 0),\
(size_t) (PTR)) | ((JOINABLE)? TCL_WIN_THREAD_JOIN_FLAG: 0)))
# define TCL_WIN_THREAD_PTR(ID)\
((WinThread *) ((sizeof ((ID) == (Tcl_ThreadId) 0),\
(size_t) (ID) & ~TCL_WIN_THREAD_JOIN_FLAG)))
# define TCL_WIN_THREAD_JOINABLE(ID)\
(((sizeof ((ID) == (Tcl_ThreadId) 0),\
(size_t) (ID) & TCL_WIN_THREAD_JOIN_FLAG)))
/*
*----------------------------------------------------------------------
*
* TclWinFailure --
*
* Call this when an unexpected WIN32 error occurs
*
* Does not return
*
*----------------------------------------------------------------------
*/
void TCL_NORETURN WINAPI
TclWinFailure (
char const *const routine)
{
Tcl_Panic ("%s failed, last error = %#x\n", routine, GetLastError ());
}
/*
*----------------------------------------------------------------------
*
* TclWinThreadStart --
*
* This procedure is the entry point for all new threads created
|
| ︙ | ︙ | |||
157 158 159 160 161 162 163 |
*/
static DWORD WINAPI
TclWinThreadStart(
LPVOID lpParameter) /* The WinThread structure pointer passed
* from TclpThreadCreate */
{
| | | < > > | | < | | | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
*/
static DWORD WINAPI
TclWinThreadStart(
LPVOID lpParameter) /* The WinThread structure pointer passed
* from TclpThreadCreate */
{
WinThread *const winThreadPtr = (WinThread *) lpParameter;
static DWORD result;
if (!winThreadPtr) {
return TCL_ERROR;
}
_controlfp(winThreadPtr->fpControl, _MCW_EM | _MCW_RC | 0x03000000 /* _MCW_DN */
#if !defined(_WIN64)
| _MCW_PC
#endif
);
if (!TlsSetValue (TclWinGlobals.tls_thread_id, winThreadPtr))
TclWinFailure ("TlsSetValue");
result = winThreadPtr->lpStartAddress (winThreadPtr->lpParameter);
if (!winThreadPtr->tHandle)
TclpSysFree (winThreadPtr);
return result;
}
/*
*----------------------------------------------------------------------
*
* TclpThreadCreate --
*
|
| ︙ | ︙ | |||
207 208 209 210 211 212 213 |
size_t stackSize, /* Size of stack for the new thread. */
int flags) /* Flags controlling behaviour of the new
* thread. */
{
WinThread *winThreadPtr; /* Per-thread startup info */
HANDLE tHandle;
| | > > < < < < < < | | > | < > > > > > | < < < | | | | > > > > > > > > | > > | > | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
size_t stackSize, /* Size of stack for the new thread. */
int flags) /* Flags controlling behaviour of the new
* thread. */
{
WinThread *winThreadPtr; /* Per-thread startup info */
HANDLE tHandle;
winThreadPtr = (WinThread *) TclpSysAlloc (sizeof *winThreadPtr);
if (!winThreadPtr)
TclWinFailure ("memory allocation");
winThreadPtr->lpStartAddress = (LPTHREAD_START_ROUTINE) proc;
winThreadPtr->lpParameter = clientData;
winThreadPtr->fpControl = _controlfp(0, 0);
#if defined(_MSC_VER) || defined(__MSVCRT__)
tHandle = (HANDLE) _beginthreadex(NULL, (unsigned) stackSize,
(Tcl_ThreadCreateProc*) TclWinThreadStart, winThreadPtr,
0 /* flags */, &winThreadPtr->thread_id);
#else
tHandle = CreateThread(NULL, (DWORD) stackSize,
TclWinThreadStart, winThreadPtr, 0 /* flags */,
&winThreadPtr->thread_id);
#endif
if (!tHandle) {
TclpSysFree (winThreadPtr);
# if 1
TclWinFailure ("CreateThread");
# else
return TCL_ERROR;
# endif
} else {
if (!(flags & TCL_THREAD_JOINABLE)) {
/*
* The only purpose of this is to decrement the reference count
* so the OS resources will be reacquired when the thread closes.
*/
if (!CloseHandle (tHandle))
TclWinFailure ("ClosseHandle");
/* note: the WIN32 OpenHandle() can be used to open a HANDLE
from the given threadID. However, if the thread
terminates with a HANDLE count of zero, the kernel may clean up
the thread, in particular its return status, immediately.
Hence, joining the thread requires keeping a HANDLE open
until the thread has been successfully joined. */
tHandle = 0;
}
winThreadPtr->tHandle = tHandle;
*idPtr = TCL_WIN_THREAD_ID (winThreadPtr, 0 != tHandle);
return TCL_OK;
}
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
269 270 271 272 273 274 275 |
int
Tcl_JoinThread(
Tcl_ThreadId threadId, /* Id of the thread to wait upon */
int *result) /* Reference to the storage the result of the
* thread we wait upon will be written into. */
{
| > > > > > > > > > > > > > > > > > > | > | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 |
int
Tcl_JoinThread(
Tcl_ThreadId threadId, /* Id of the thread to wait upon */
int *result) /* Reference to the storage the result of the
* thread we wait upon will be written into. */
{
if (!TCL_WIN_THREAD_JOINABLE (threadId))
return TCL_ERROR;
WinThread *winThreadPtr = TCL_WIN_THREAD_PTR (threadId);
HANDLE const tHandle = winThreadPtr->tHandle;
switch (WaitForSingleObject (tHandle, INFINITE)) {
DWORD exit_code;
default:
return TCL_ERROR;
case WAIT_FAILED:
TclWinFailure ("WaitForSingleObject");
case WAIT_OBJECT_0:
if (!GetExitCodeThread (tHandle, &exit_code))
TclWinFailure ("GetExitCodeThread");
*result = exit_code;
if (!CloseHandle (tHandle))
TclWinFailure ("CloseHandle");
TclpSysFree (winThreadPtr);
return TCL_OK;
}
}
/*
*----------------------------------------------------------------------
*
* TclpThreadExit --
*
|
| ︙ | ︙ | |||
292 293 294 295 296 297 298 |
*----------------------------------------------------------------------
*/
void
TclpThreadExit(
int status)
{
| | | | > > | | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 |
*----------------------------------------------------------------------
*/
void
TclpThreadExit(
int status)
{
WinThread *winThreadPtr;
if (winThreadPtr = (WinThread *) TlsGetValue (
TclWinGlobals.tls_thread_id)) {
if (!winThreadPtr->tHandle)
TclpSysFree (winThreadPtr);
}
#if defined(_MSC_VER) || defined(__MSVCRT__)
_endthreadex((unsigned) status);
#else
ExitThread((DWORD) status);
#endif
}
|
| ︙ | ︙ | |||
322 323 324 325 326 327 328 |
*
*----------------------------------------------------------------------
*/
Tcl_ThreadId
Tcl_GetCurrentThread(void)
{
| > > > > > > > | > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 |
*
*----------------------------------------------------------------------
*/
Tcl_ThreadId
Tcl_GetCurrentThread(void)
{
WinThread *winThreadPtr;
if (!(winThreadPtr = (WinThread *) TlsGetValue (
TclWinGlobals.tls_thread_id))) {
if (ERROR_SUCCESS != GetLastError ())
TclWinFailure ("TlsGetValue in Tcl_GetCurrentThread");
/* this is an initial thread */
/* can't use TclAlloc, as the USE_THREAD_ALLOC per-thread allocator
calls Tcl_GetCurrentThread() */
if (!(winThreadPtr = (WinThread *) TclpSysAlloc (sizeof *winThreadPtr)))
TclWinFailure ("memory allocation");
winThreadPtr->tHandle = 0;
winThreadPtr->thread_id = GetCurrentThreadId ();
if (!TlsSetValue (TclWinGlobals.tls_thread_id, winThreadPtr))
TclWinFailure ("TlsSetValue");
}
return TCL_WIN_THREAD_ID (winThreadPtr, 0 != winThreadPtr->tHandle);
}
/*
*----------------------------------------------------------------------
*
* TclWinInitOnce
*
* Perform module initialization exactly once
* storage keys.
*
* Results:
* None.
*
*
*----------------------------------------------------------------------
*/
static BOOL
TclWinInitOnce (
INIT_ONCE *init_once,
void *parameter,
void *context)
{
struct tclWinGlobals *const twg = parameter;
InitializeCriticalSection(&twg->initLock);
InitializeCriticalSection(&twg->globalLock);
twg->tls_thread_id = TlsAlloc ();
#if TCL_THREADS
InitializeCriticalSection(&twg->allocLock.crit);
twg->allocLockPtr = &twg->allocLock;
#endif /* TCL_THREADS */
return TRUE;
}
# define TCL_WIN_INITIALIZE_ONCE()\
InitOnceExecuteOnce (&TclWinGlobals.init_once,\
TclWinInitOnce,\
&TclWinGlobals,\
0)
/*
*----------------------------------------------------------------------
*
* TclpInitLock
*
* This procedure is used to grab a lock that serializes initialization
|
| ︙ | ︙ | |||
347 348 349 350 351 352 353 |
*
*----------------------------------------------------------------------
*/
void
TclpInitLock(void)
{
| | < < < < < < | < < < < < | | 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 |
*
*----------------------------------------------------------------------
*/
void
TclpInitLock(void)
{
if (!TCL_WIN_INITIALIZE_ONCE ())
TclWinFailure ("InitOnceExecuteOnce");
EnterCriticalSection(&TclWinGlobals.initLock);
}
/*
*----------------------------------------------------------------------
*
* TclpInitUnlock
*
|
| ︙ | ︙ | |||
383 384 385 386 387 388 389 |
*
*----------------------------------------------------------------------
*/
void
TclpInitUnlock(void)
{
| | | 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 |
*
*----------------------------------------------------------------------
*/
void
TclpInitUnlock(void)
{
LeaveCriticalSection(&TclWinGlobals.initLock);
}
/*
*----------------------------------------------------------------------
*
* TclpGlobalLock
*
|
| ︙ | ︙ | |||
409 410 411 412 413 414 415 |
*
*----------------------------------------------------------------------
*/
void
TclpGlobalLock(void)
{
| | < < < < < < | < < < < < | | 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 |
*
*----------------------------------------------------------------------
*/
void
TclpGlobalLock(void)
{
if (!TCL_WIN_INITIALIZE_ONCE ())
TclWinFailure ("InitOnceExecuteOnce");
EnterCriticalSection(&TclWinGlobals.globalLock);
}
/*
*----------------------------------------------------------------------
*
* TclpGlobalUnlock
*
|
| ︙ | ︙ | |||
445 446 447 448 449 450 451 |
*
*----------------------------------------------------------------------
*/
void
TclpGlobalUnlock(void)
{
| | | 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 |
*
*----------------------------------------------------------------------
*/
void
TclpGlobalUnlock(void)
{
LeaveCriticalSection(&TclWinGlobals.globalLock);
}
/*
*----------------------------------------------------------------------
*
* Tcl_GetAllocMutex
*
|
| ︙ | ︙ | |||
471 472 473 474 475 476 477 |
*----------------------------------------------------------------------
*/
Tcl_Mutex *
Tcl_GetAllocMutex(void)
{
#if TCL_THREADS
| | < | < | | 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 |
*----------------------------------------------------------------------
*/
Tcl_Mutex *
Tcl_GetAllocMutex(void)
{
#if TCL_THREADS
if (!TCL_WIN_INITIALIZE_ONCE ())
TclWinFailure ("InitOnceExecuteOnce");
return &TclWinGlobals.allocLockPtr;
#else
return NULL;
#endif
}
/*
*----------------------------------------------------------------------
|
| ︙ | ︙ | |||
502 503 504 505 506 507 508 509 |
*
*----------------------------------------------------------------------
*/
void
TclFinalizeLock(void)
{
TclpGlobalLock();
| > | > > | < < | < < | | > > > < < < | 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
*
*----------------------------------------------------------------------
*/
void
TclFinalizeLock(void)
{
struct tclWinGlobals *const twg = &TclWinGlobals;
TclpGlobalLock();
if (!TlsFree (twg->tls_thread_id))
TclWinFailure ("TlsFree");
/*
* Destroy the critical section that we are holding!
*/
DeleteCriticalSection(&twg->globalLock);
#if TCL_THREADS
DeleteCriticalSection(&twg->allocLock.crit);
#endif
LeaveCriticalSection(&twg->initLock);
/*
* Destroy the critical section that we were holding.
*/
DeleteCriticalSection(&twg->initLock);
InitOnceInitialize (&twg->init_once); /* assuming we want to
re-initialize at some point -- dubious */
}
#if TCL_THREADS
/*
*----------------------------------------------------------------------
*
* Tcl_MutexLock --
*
* This procedure is invoked to lock a mutex. This is a self initializing
|
| ︙ | ︙ | |||
554 555 556 557 558 559 560 |
*----------------------------------------------------------------------
*/
void
Tcl_MutexLock(
Tcl_Mutex *mutexPtr) /* The lock */
{
| | > | | | < | | 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 |
*----------------------------------------------------------------------
*/
void
Tcl_MutexLock(
Tcl_Mutex *mutexPtr) /* The lock */
{
struct Tcl_Mutex_ *mp;
if (*mutexPtr == NULL) {
TclpGlobalLock();
/*
* Double inside global lock check to avoid a race.
* BROKEN: does work in relaxed memory models
*/
if (*mutexPtr == NULL) {
mp = Tcl_Alloc (sizeof *mp);
InitializeCriticalSection (&mp->crit);
*mutexPtr = mp;
TclRememberMutex(mutexPtr);
}
TclpGlobalUnlock();
}
EnterCriticalSection (&(*mutexPtr)->crit);
}
/*
*----------------------------------------------------------------------
*
* Tcl_MutexUnlock --
*
|
| ︙ | ︙ | |||
595 596 597 598 599 600 601 |
*----------------------------------------------------------------------
*/
void
Tcl_MutexUnlock(
Tcl_Mutex *mutexPtr) /* The lock */
{
| < < | | 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 |
*----------------------------------------------------------------------
*/
void
Tcl_MutexUnlock(
Tcl_Mutex *mutexPtr) /* The lock */
{
LeaveCriticalSection (&(*mutexPtr)->crit);
}
/*
*----------------------------------------------------------------------
*
* TclpFinalizeMutex --
*
|
| ︙ | ︙ | |||
621 622 623 624 625 626 627 |
*----------------------------------------------------------------------
*/
void
TclpFinalizeMutex(
Tcl_Mutex *mutexPtr)
{
| < | < | | | 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 |
*----------------------------------------------------------------------
*/
void
TclpFinalizeMutex(
Tcl_Mutex *mutexPtr)
{
if (*mutexPtr) {
DeleteCriticalSection(&(*mutexPtr)->crit);
Tcl_Free(*mutexPtr);
*mutexPtr = NULL;
}
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | ︙ | |||
804 805 806 807 808 809 810 | /* *---------------------------------------------------------------------- * * Tcl_ConditionNotify -- * * This procedure is invoked to signal a condition variable. * | | | < < | | < > | < < | < < < < < | | < | < < < | < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < | < < < < < | < < | 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 |
/*
*----------------------------------------------------------------------
*
* Tcl_ConditionNotify --
*
* This procedure is invoked to signal a condition variable.
*
* The mutex does not need to be held during this call to avoid races
* and should not be, to minimize the number of context switches
*
* Results:
* None.
*
* Side effects:
* May unblock another thread.
*
*----------------------------------------------------------------------
*/
void
Tcl_ConditionNotify(
Tcl_Condition *condPtr)
{
/* double checked locking, i.e., BROKEN */
if (*condPtr == NULL) {
TclpGlobalLock();
if (*condPtr == NULL) {
WinCondition *winCondPtr;
winCondPtr = (WinCondition *)Tcl_Alloc(sizeof *winCondPtr);
InitializeConditionVariable (&winCondPtr->cv);
*condPtr = winCondPtr;
}
TclpGlobalUnlock();
}
WakeAllConditionVariable (&(*condPtr)->cv);
}
/*
*----------------------------------------------------------------------
*
* TclpFinalizeCondition --
*
|
| ︙ | ︙ | |||
907 908 909 910 911 912 913 |
*----------------------------------------------------------------------
*/
void
TclpFinalizeCondition(
Tcl_Condition *condPtr)
{
| | < > > > > > > > | 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 |
*----------------------------------------------------------------------
*/
void
TclpFinalizeCondition(
Tcl_Condition *condPtr)
{
WinCondition *winCondPtr = *condPtr;
/*
* Note - this is called long after the thread-local storage is reclaimed.
* The per-thread condition waiting event is reclaimed earlier in a
* per-thread exit handler, which is called before thread local storage is
* reclaimed.
*/
if (winCondPtr != NULL) {
Tcl_Free(winCondPtr);
*condPtr = NULL;
}
}
/*
* Additions by AOL for specialized thread memory allocator.
*/
#ifdef USE_THREAD_ALLOC
static DWORD tlsKey;
typedef struct {
Tcl_Mutex tlock;
CRITICAL_SECTION wlock;
} allocMutex;
Tcl_Mutex *
TclpNewAllocMutex(void)
{
allocMutex *lockPtr;
lockPtr = (allocMutex *)malloc(sizeof(allocMutex));
|
| ︙ | ︙ |