summaryrefslogtreecommitdiffstats
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
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().
-rw-r--r--ChangeLog5
-rw-r--r--win/tclWinSock.c13
2 files changed, 12 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 6f84707..1a372f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-11-07 Don Porter <dgp@users.sourceforge.net>
+
+ * win/tclWinSock.c: [Bug 3574493] Avoid hanging on exit due to
+ use of synchronization calls in routines called by DllMain().
+
2012-10-03 Don Porter <dgp@users.sourceforge.net>
* generic/tclIO.c: When checking for std channels being closed,
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);