diff options
author | redman <redman> | 1999-07-27 01:42:21 (GMT) |
---|---|---|
committer | redman <redman> | 1999-07-27 01:42:21 (GMT) |
commit | fd9ef8bf5fa340e0b2995c55613fbaa12653dbb0 (patch) | |
tree | 9f2d4d9a9a9b32df258998390716ed7d9de546d0 /win | |
parent | 1f5265171e2ddeade8350713feba432d2d862d2f (diff) | |
download | tcl-fd9ef8bf5fa340e0b2995c55613fbaa12653dbb0.zip tcl-fd9ef8bf5fa340e0b2995c55613fbaa12653dbb0.tar.gz tcl-fd9ef8bf5fa340e0b2995c55613fbaa12653dbb0.tar.bz2 |
Bug fixes for threaded Tcl on NT with single and dual CPUs. Still some
open issues, this code is a little more stable though.
Diffstat (limited to 'win')
-rw-r--r-- | win/tclWinConsole.c | 8 | ||||
-rw-r--r-- | win/tclWinPipe.c | 10 | ||||
-rw-r--r-- | win/tclWinSock.c | 11 |
3 files changed, 21 insertions, 8 deletions
diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index bd50859..7d62a5a 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.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: tclWinConsole.c,v 1.2 1999/04/16 00:48:07 stanton Exp $ + * RCS: @(#) $Id: tclWinConsole.c,v 1.3 1999/07/27 01:42:25 redman Exp $ */ #include "tclWinInt.h" @@ -486,7 +486,6 @@ ConsoleCloseProc( Tcl_MutexLock(&consoleMutex); TerminateThread(consolePtr->readThread, 0); - Tcl_MutexUnlock(&consoleMutex); /* * Wait for the thread to terminate. This ensures that we are @@ -494,6 +493,8 @@ ConsoleCloseProc( */ WaitForSingleObject(consolePtr->readThread, INFINITE); + Tcl_MutexUnlock(&consoleMutex); + CloseHandle(consolePtr->readThread); CloseHandle(consolePtr->readable); CloseHandle(consolePtr->startReader); @@ -522,7 +523,6 @@ ConsoleCloseProc( Tcl_MutexLock(&consoleMutex); TerminateThread(consolePtr->writeThread, 0); - Tcl_MutexUnlock(&consoleMutex); /* * Wait for the thread to terminate. This ensures that we are @@ -530,6 +530,8 @@ ConsoleCloseProc( */ WaitForSingleObject(consolePtr->writeThread, INFINITE); + Tcl_MutexUnlock(&consoleMutex); + CloseHandle(consolePtr->writeThread); CloseHandle(consolePtr->writable); CloseHandle(consolePtr->startWriter); diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 6d182fa..565445e 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.6 1999/05/21 18:28:45 redman Exp $ + * RCS: @(#) $Id: tclWinPipe.c,v 1.7 1999/07/27 01:42:25 redman Exp $ */ #include "tclWinInt.h" @@ -2164,7 +2164,6 @@ PipeClose2Proc( Tcl_MutexLock(&pipeMutex); TerminateThread(pipePtr->readThread, 0); - Tcl_MutexUnlock(&pipeMutex); /* * Wait for the thread to terminate. This ensures that we are @@ -2172,6 +2171,8 @@ PipeClose2Proc( */ WaitForSingleObject(pipePtr->readThread, INFINITE); + Tcl_MutexUnlock(&pipeMutex); + CloseHandle(pipePtr->readThread); CloseHandle(pipePtr->readable); CloseHandle(pipePtr->startReader); @@ -2206,8 +2207,6 @@ PipeClose2Proc( Tcl_MutexLock(&pipeMutex); TerminateThread(pipePtr->writeThread, 0); - Tcl_MutexUnlock(&pipeMutex); - /* * Wait for the thread to terminate. This ensures that we are @@ -2215,6 +2214,9 @@ PipeClose2Proc( */ WaitForSingleObject(pipePtr->writeThread, INFINITE); + Tcl_MutexUnlock(&pipeMutex); + + CloseHandle(pipePtr->writeThread); CloseHandle(pipePtr->writable); CloseHandle(pipePtr->startWriter); diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 7b63168..688df20 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinSock.c,v 1.13 1999/07/22 23:45:53 redman Exp $ + * RCS: @(#) $Id: tclWinSock.c,v 1.14 1999/07/27 01:42:25 redman Exp $ */ #include "tclWinInt.h" @@ -583,7 +583,16 @@ SocketThreadExitHandler(clientData) (ThreadSpecificData *)TclThreadDataKeyGet(&dataKey); if (tsdPtr->socketThread != NULL) { + Tcl_MutexLock(&socketMutex); TerminateThread(tsdPtr->socketThread, 0); + + /* + * Wait for the thread to terminate. This ensures that we are + * completely cleaned up before we leave this function. + */ + + WaitForSingleObject(tsdPtr->socketThread, INFINITE); + Tcl_MutexUnlock(&socketMutex); } if (tsdPtr->hwnd != NULL) { DestroyWindow(tsdPtr->hwnd); |