summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvasiljevic <zv@archiware.com>2007-03-24 09:31:06 (GMT)
committervasiljevic <zv@archiware.com>2007-03-24 09:31:06 (GMT)
commit9001e4a12a8cb6226719049f272585d73ca82f54 (patch)
treec7f261e5432f1b414d4a9a69b08b84d4f204ff76
parent85d645e7d34a62d8b3e0211277b9271fb32dce66 (diff)
downloadtcl-9001e4a12a8cb6226719049f272585d73ca82f54.zip
tcl-9001e4a12a8cb6226719049f272585d73ca82f54.tar.gz
tcl-9001e4a12a8cb6226719049f272585d73ca82f54.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.c19
2 files changed, 15 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index e98e9b7..94a969b 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-19 Don Porter <dgp@users.sourceforge.net>
* generic/tclEvent.c (Tcl_CreateThread): Replaced some calls to
diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c
index e82b26a..acac81b 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.24.2.11 2005/05/30 01:36:53 hobbs Exp $
+ * RCS: @(#) $Id: tclWinThrd.c,v 1.24.2.12 2007/03/24 09:31:11 vasiljevic Exp $
*/
#include "tclWinInt.h"
@@ -107,13 +107,11 @@ typedef struct allocMutex {
* of the way 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
@@ -789,14 +787,6 @@ Tcl_ConditionWait(condPtr, mutexPtr, timePtr)
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
@@ -956,9 +946,14 @@ Tcl_ConditionNotify(condPtr)
{
WinCondition *winCondPtr;
ThreadSpecificData *tsdPtr;
+
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
@@ -1008,7 +1003,7 @@ FinalizeConditionEvent(data)
ClientData data;
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)data;
- tsdPtr->flags = WIN_THREAD_DEAD;
+ tsdPtr->flags = WIN_THREAD_UNINIT;
CloseHandle(tsdPtr->condEvent);
}