summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavygrvy <davygrvy@pobox.com>2004-02-21 02:17:31 (GMT)
committerdavygrvy <davygrvy@pobox.com>2004-02-21 02:17:31 (GMT)
commitc7af0f6068720e7d18a61e75a17712373d39b1bc (patch)
tree234be764e1ada6798de39a88c2636353f755fc25
parent9081893af6246e0efbedb0ffda8411f22785b292 (diff)
downloadtcl-c7af0f6068720e7d18a61e75a17712373d39b1bc.zip
tcl-c7af0f6068720e7d18a61e75a17712373d39b1bc.tar.gz
tcl-c7af0f6068720e7d18a61e75a17712373d39b1bc.tar.bz2
(SocketThreadExitHandler): Don't call TerminateThread when
WaitForSingleObject returns a timeout. Tcl_Finalize called from DllMain will pause all threads. Trust that the thread will get the close notice at a later time if it does ever wake up before being cleaned up by the system anyway.
-rw-r--r--win/tclWinSock.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index a790b31..b52b4f3 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.41 2003/12/24 04:18:23 davygrvy Exp $
+ * RCS: @(#) $Id: tclWinSock.c,v 1.42 2004/02/21 02:17:31 davygrvy Exp $
*/
#include "tclWinInt.h"
@@ -626,24 +626,15 @@ SocketThreadExitHandler(clientData)
GetExitCodeThread(tsdPtr->socketThread, &exitCode);
if (exitCode == STILL_ACTIVE) {
- DWORD dwWait;
PostMessage(tsdPtr->hwnd, SOCKET_TERMINATE, 0, 0);
-
/*
* Wait for the thread to close. This ensures that we are
- * completely cleaned up before we leave this function.
+ * completely cleaned up before we leave this function.
+ * If Tcl_Finalize was called from DllMain, the thread
+ * is in a paused state so we need to timeout and continue.
*/
- dwWait = WaitForSingleObject(tsdPtr->socketThread, 100);
- if (dwWait == WAIT_TIMEOUT) {
- /*
- * Avoids a lock-up, just in case it is needed from an
- * unclean exit condition when the thread appears
- * running, but isn't.
- */
-
- TerminateThread(tsdPtr->socketThread, EXIT_FAILURE);
- }
+ WaitForSingleObject(tsdPtr->socketThread, 100);
}
CloseHandle(tsdPtr->socketThread);
tsdPtr->socketThread = NULL;