summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authordavygrvy <davygrvy@pobox.com>2004-05-06 01:03:56 (GMT)
committerdavygrvy <davygrvy@pobox.com>2004-05-06 01:03:56 (GMT)
commite545850e9721d9936caa3475993a988c63f3ec65 (patch)
tree0c6d6503ffdfca60c6c688aaa834cd5745fb20d7 /win
parente166c0cd095d11af250326255dc2a976cd87ea58 (diff)
downloadtcl-e545850e9721d9936caa3475993a988c63f3ec65.zip
tcl-e545850e9721d9936caa3475993a988c63f3ec65.tar.gz
tcl-e545850e9721d9936caa3475993a988c63f3ec65.tar.bz2
* win/tclWinSock.c:
(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. (SocketEventProc) : connect errors should fire both the readable and writable handlers because this is how it works on UNIX [Bug 794839]
Diffstat (limited to 'win')
-rw-r--r--win/tclWinSock.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index 4586698..3d0d5f0 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.36.2.1 2003/10/23 16:24:42 andreas_kupries Exp $
+ * RCS: @(#) $Id: tclWinSock.c,v 1.36.2.2 2004/05/06 01:03:56 davygrvy Exp $
*/
#include "tclWinInt.h"
@@ -627,13 +627,14 @@ SocketThreadExitHandler(clientData)
GetExitCodeThread(tsdPtr->socketThread, &exitCode);
if (exitCode == STILL_ACTIVE) {
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.
*/
- WaitForSingleObject(tsdPtr->socketThread, INFINITE);
+ WaitForSingleObject(tsdPtr->socketThread, 100);
}
CloseHandle(tsdPtr->socketThread);
tsdPtr->socketThread = NULL;
@@ -900,6 +901,10 @@ SocketEventProc(evPtr, flags)
}
if (events & (FD_WRITE | FD_CONNECT)) {
mask |= TCL_WRITABLE;
+ if (events & FD_CONNECT && infoPtr->lastError != NO_ERROR) {
+ /* connect errors should also fire the readable handler. */
+ mask |= TCL_READABLE;
+ }
}
if (mask) {