summaryrefslogtreecommitdiffstats
path: root/win/tclWinSock.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2012-11-07 17:26:48 (GMT)
committerdgp <dgp@users.sourceforge.net>2012-11-07 17:26:48 (GMT)
commit842e894ac59736384fa19082286b29b46e1a3a24 (patch)
treee98febf106290ca820edd5a8656d86fde19d2b53 /win/tclWinSock.c
parent20ad704b92c881804d8cae7e891c2e55e6ab7196 (diff)
parent9123f8f93ed83b6d013c28df71ee8394112fce28 (diff)
downloadtcl-842e894ac59736384fa19082286b29b46e1a3a24.zip
tcl-842e894ac59736384fa19082286b29b46e1a3a24.tar.gz
tcl-842e894ac59736384fa19082286b29b46e1a3a24.tar.bz2
3574493 Avoid hanging on exit due to use of synchronization calls in
routines called by DllMain().
Diffstat (limited to 'win/tclWinSock.c')
-rw-r--r--win/tclWinSock.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index 8f2028d..9fa01c9 100644
--- a/win/tclWinSock.c
+++ b/win/tclWinSock.c
@@ -460,14 +460,13 @@ TclpFinalizeSockets(void)
if (tsdPtr != NULL) {
if (tsdPtr->socketThread != NULL) {
if (tsdPtr->hwnd != NULL) {
- PostMessage(tsdPtr->hwnd, SOCKET_TERMINATE, 0, 0);
-
- /*
- * Wait for the thread to exit. This ensures that we are
- * completely cleaned up before we leave this function.
- */
-
- WaitForSingleObject(tsdPtr->readyEvent, INFINITE);
+ if (PostMessage(tsdPtr->hwnd, SOCKET_TERMINATE, 0, 0)) {
+ /*
+ * Wait for the thread to exit. This ensures that we are
+ * completely cleaned up before we leave this function.
+ */
+ WaitForSingleObject(tsdPtr->readyEvent, INFINITE);
+ }
tsdPtr->hwnd = NULL;
}
CloseHandle(tsdPtr->socketThread);