From ba16c7a4403b1fa99daafb9292751bf572c09616 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 7 Nov 2012 17:24:12 +0000 Subject: 3574493 Avoid hanging on exit due to use of synchronization calls in routines called by DllMain(). --- ChangeLog | 5 +++++ win/tclWinSock.c | 13 +++++++------ 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 + + * 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 * 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); -- cgit v0.12