From 48de644544436ea0ccdb1aad39f288c3801e06d5 Mon Sep 17 00:00:00 2001 From: vasiljevic Date: Sat, 24 Mar 2007 09:33:02 +0000 Subject: 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. --- ChangeLog | 8 ++++++++ win/tclWinThrd.c | 18 ++++++------------ 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 + + * 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 * 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); } -- cgit v0.12