Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 139688c27bf8868d9472f34965d82199f353f3d9
Ticket: 1437595fffffffffffffffffffffffffffffffff
WinSock cores/hangs on thread or app exit
User & Date: dunkfan on 2006-09-29 18:28:08
Changes

  1. icomment:
    Logged In: YES 
    user_id=1183601
    
    FWIW I had a hanging problem with 8.4.13 XPSP2 after 
    calling exit. 
    
    Tracked it down to tclwinsock.c WaitForSingleObject(tsdPtr-
    >readyEvent, INFINITE);
    in the TclpFinalizeSockets() code...
    
    Then I included the code which used to be in there (from 
    8.4.6) to check whether the thread was STILL_ACTIVE before 
    jumping into the Wait call.
    
    DWORD exitCode;
    GetExitCodeThread(tsdPtr->socketThread, &exitCode);
       if (exitCode == STILL_ACTIVE) {
           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);
        tsdPtr->hwnd = NULL;
    }
        }
    
    That seems to cure the problem...
    
    
    
  2. login: "dunkfan"
  3. mimetype: "text/plain"
  4. username: "dunkfan"