summaryrefslogtreecommitdiffstats
path: root/win/tclWinPipe.c
diff options
context:
space:
mode:
authorvasiljevic <zv@archiware.com>2006-03-10 17:34:35 (GMT)
committervasiljevic <zv@archiware.com>2006-03-10 17:34:35 (GMT)
commit460ab8d61073035ef210eab755012863ce259286 (patch)
treee8c78ad00a57a9b7cc5a80bbef071a1980b83cf0 /win/tclWinPipe.c
parent189013828dfa579f32716b46c6da51e40b6e0de9 (diff)
downloadtcl-460ab8d61073035ef210eab755012863ce259286.zip
tcl-460ab8d61073035ef210eab755012863ce259286.tar.gz
tcl-460ab8d61073035ef210eab755012863ce259286.tar.bz2
Finalization of the sockets/pipes
is now solely done in TclpFinalizeSockets() and TclpFinalizePipes() and not over the thread-exit handler, because the order of actions the Tcl generic core will impose may result in cores/hangs if the thread exit handler tears down corresponding subsystem(s) too early.
Diffstat (limited to 'win/tclWinPipe.c')
-rw-r--r--win/tclWinPipe.c43
1 files changed, 10 insertions, 33 deletions
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c
index 80eb3c0..9046305 100644
--- a/win/tclWinPipe.c
+++ b/win/tclWinPipe.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: tclWinPipe.c,v 1.61 2005/11/04 23:01:40 patthoyts Exp $
+ * RCS: @(#) $Id: tclWinPipe.c,v 1.62 2006/03/10 17:34:35 vasiljevic Exp $
*/
#include "tclWinInt.h"
@@ -187,7 +187,6 @@ static void PipeCheckProc(ClientData clientData, int flags);
static int PipeClose2Proc(ClientData instanceData,
Tcl_Interp *interp, int flags);
static int PipeEventProc(Tcl_Event *evPtr, int flags);
-static void PipeExitHandler(ClientData clientData);
static int PipeGetHandleProc(ClientData instanceData,
int direction, ClientData *handlePtr);
static void PipeInit(void);
@@ -268,47 +267,22 @@ PipeInit(void)
tsdPtr = TCL_TSD_INIT(&dataKey);
tsdPtr->firstPipePtr = NULL;
Tcl_CreateEventSource(PipeSetupProc, PipeCheckProc, NULL);
- Tcl_CreateThreadExitHandler(PipeExitHandler, NULL);
}
}
/*
*----------------------------------------------------------------------
*
- * PipeExitHandler --
- *
- * This function is called to cleanup the pipe module before Tcl is
- * unloaded.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Removes the pipe event source.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-PipeExitHandler(
- ClientData clientData) /* Old window proc */
-{
- Tcl_DeleteEventSource(PipeSetupProc, PipeCheckProc, NULL);
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TclpFinalizePipes --
*
- * This function is called to cleanup the process list before Tcl is
- * unloaded.
+ * This function is called from Tcl_FinalizeThread to finalize the
+ * platform specific pipe subsystem.
*
* Results:
* None.
*
* Side effects:
- * Resets the process list.
+ * Removes the pipe event source.
*
*----------------------------------------------------------------------
*/
@@ -316,9 +290,12 @@ PipeExitHandler(
void
TclpFinalizePipes(void)
{
- Tcl_MutexLock(&pipeMutex);
- initialized = 0;
- Tcl_MutexUnlock(&pipeMutex);
+ ThreadSpecificData *tsdPtr;
+
+ tsdPtr = (ThreadSpecificData *)TclThreadDataKeyGet(&dataKey);
+ if (tsdPtr != NULL) {
+ Tcl_DeleteEventSource(PipeSetupProc, PipeCheckProc, NULL);
+ }
}
/*