summaryrefslogtreecommitdiffstats
path: root/win/tclWinSock.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2012-11-07 17:24:12 (GMT)
committerdgp <dgp@users.sourceforge.net>2012-11-07 17:24:12 (GMT)
commitba16c7a4403b1fa99daafb9292751bf572c09616 (patch)
tree06ae563ede46ef35f44a42ae7397acb4bb0b2846 /win/tclWinSock.c
parent188bfaf1aed5fe7441748433f69ccfe434c841f3 (diff)
downloadtcl-ba16c7a4403b1fa99daafb9292751bf572c09616.zip
tcl-ba16c7a4403b1fa99daafb9292751bf572c09616.tar.gz
tcl-ba16c7a4403b1fa99daafb9292751bf572c09616.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.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index 328198b..050564d 100644
--- a/win/tclWinSock.c
+++ b/win/tclWinSock.c
@@ -659,12 +659,13 @@ TclpFinalizeSockets()
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);