summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvasiljevic <zv@archiware.com>2007-03-24 09:33:02 (GMT)
committervasiljevic <zv@archiware.com>2007-03-24 09:33:02 (GMT)
commit48de644544436ea0ccdb1aad39f288c3801e06d5 (patch)
tree34201bf364febd493d5dea46ab11b83cfd4298cb
parent12eaf38453be7e97fa3bddfdd337d03921be6a22 (diff)
downloadtcl-48de644544436ea0ccdb1aad39f288c3801e06d5.zip
tcl-48de644544436ea0ccdb1aad39f288c3801e06d5.tar.gz
tcl-48de644544436ea0ccdb1aad39f288c3801e06d5.tar.bz2
Thread exit handler marks the current thread as un-initialized.
This allows exit handlers that are registered later to re-initialize this subsystem in case they need to use some sync primitives (cond variables) from this file again.
-rw-r--r--ChangeLog8
-rw-r--r--win/tclWinThrd.c18
2 files changed, 14 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 8b49f58..a9a7aa7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-03-24 Zoran Vasiljevic <vasiljevic@users.sourceforge.net>
+
+ * win/tclWinThrd.c: Thread exit handler marks the current
+ thread as un-initialized. This allows exit handlers that
+ are registered later to re-initialize this subsystem in
+ case they need to use some sync primitives (cond variables)
+ from this file again.
+
2007-03-23 Miguel Sofer <msofer@users.sf.net>
* generic/tclBasic.c (DeleteInterpProc): pop the root frame
diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c
index 98137c4..650e523 100644
--- a/win/tclWinThrd.c
+++ b/win/tclWinThrd.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinThrd.c,v 1.42 2006/08/10 12:15:32 dkf Exp $
+ * RCS: @(#) $Id: tclWinThrd.c,v 1.43 2007/03/24 09:33:02 vasiljevic Exp $
*/
#include "tclWinInt.h"
@@ -92,13 +92,11 @@ static Tcl_ThreadDataKey dataKey;
* ThreadSpecificData is created.
* WIN_THREAD_RUNNING Running, not waiting.
* WIN_THREAD_BLOCKED Waiting, or trying to wait.
- * WIN_THREAD_DEAD Dying - no per-thread event anymore.
*/
#define WIN_THREAD_UNINIT 0x0
#define WIN_THREAD_RUNNING 0x1
#define WIN_THREAD_BLOCKED 0x2
-#define WIN_THREAD_DEAD 0x4
/*
* The per condition queue pointers and the Mutex used to serialize access to
@@ -600,14 +598,6 @@ Tcl_ConditionWait(
int doExit = 0; /* True if we need to do exit setup */
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
- if (tsdPtr->flags & WIN_THREAD_DEAD) {
- /*
- * No more per-thread event on which to wait.
- */
-
- return;
- }
-
/*
* Self initialize the two parts of the condition. The per-condition and
* per-thread parts need to be handled independently.
@@ -768,6 +758,10 @@ Tcl_ConditionNotify(
if (*condPtr != NULL) {
winCondPtr = *((WinCondition **)condPtr);
+ if (winCondPtr == NULL) {
+ return;
+ }
+
/*
* Loop through all the threads waiting on the condition and notify
* them (i.e., broadcast semantics). The queue manipulation is guarded
@@ -817,7 +811,7 @@ FinalizeConditionEvent(
ClientData data)
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *) data;
- tsdPtr->flags = WIN_THREAD_DEAD;
+ tsdPtr->flags = WIN_THREAD_UNINIT;
CloseHandle(tsdPtr->condEvent);
}