summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);