summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/configure.in1
-rw-r--r--win/tclWinSock.c13
2 files changed, 8 insertions, 6 deletions
diff --git a/win/configure.in b/win/configure.in
index f839521..635469b 100644
--- a/win/configure.in
+++ b/win/configure.in
@@ -119,6 +119,7 @@ AC_CACHE_CHECK(for LPFN_ACCEPT support in winsock2.h,
tcl_cv_lpfn_decls,
AC_TRY_COMPILE([
#define WIN32_LEAN_AND_MEAN
+#define INCL_WINSOCK_API_TYPEDEFS 1
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#include <winsock2.h>
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);