655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
|
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
|
-
-
-
-
-
-
+
+
+
+
+
+
+
|
{
ThreadSpecificData *tsdPtr;
tsdPtr = (ThreadSpecificData *)TclThreadDataKeyGet(&dataKey);
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);
tsdPtr->socketThread = NULL;
}
if (tsdPtr->readyEvent != NULL) {
CloseHandle(tsdPtr->readyEvent);
|