From 2a5093e8452e5ec2c6d52b77e936eda1508cb2f1 Mon Sep 17 00:00:00 2001 From: redman Date: Thu, 29 Jul 1999 22:58:22 +0000 Subject: win/tclWinSock.c: free Win32 Event handles when destroying socket helper threads. --- ChangeLog | 7 ++++++- win/tclWinSock.c | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0b8f05d..0a51b5e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,9 @@ -1999-07-28 Jennifer Hom +1999-07-29 + + * win/tclWinSock.c: Free Win32 Event handles when destroying + the socket helper thread. + +1999-07-28 * tests/tcltest.test: * library/tcltest1.0/tcltest.tcl: Fixed the condition under which diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 688df20..7d6651f 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinSock.c,v 1.14 1999/07/27 01:42:25 redman Exp $ + * RCS: @(#) $Id: tclWinSock.c,v 1.15 1999/07/29 22:58:24 redman Exp $ */ #include "tclWinInt.h" @@ -489,6 +489,7 @@ unloadLibrary: tsdPtr->socketThread = NULL; } CloseHandle(tsdPtr->readyEvent); + CloseHandle(tsdPtr->socketListLock); } FreeLibrary(winSock.hInstance); winSock.hInstance = NULL; @@ -583,6 +584,8 @@ SocketThreadExitHandler(clientData) (ThreadSpecificData *)TclThreadDataKeyGet(&dataKey); if (tsdPtr->socketThread != NULL) { + + WaitForSingleObject(tsdPtr->socketListLock, INFINITE); Tcl_MutexLock(&socketMutex); TerminateThread(tsdPtr->socketThread, 0); @@ -592,6 +595,8 @@ SocketThreadExitHandler(clientData) */ WaitForSingleObject(tsdPtr->socketThread, INFINITE); + CloseHandle(tsdPtr->readyEvent); + CloseHandle(tsdPtr->socketListLock); Tcl_MutexUnlock(&socketMutex); } if (tsdPtr->hwnd != NULL) { -- cgit v0.12