Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: de7f071b2cc2bd048af4bc824da192c6648b4f7a
Ticket: 132fad6fde1b40e8f1e2081884313a98fdd1d4cc
exit 0 - Hangs under Windows
User & Date: ferrieux on 2014-09-02 19:51:27
Changes

  1. icomment:
    Though Sean identified the critical commit as 4ca7fe7cf209ccf83375421d45464ff9a5f90a29 (use of TclpSysFree et al), which could be fixed, I don't think TclFinalizeThreadAllocThread is useful at exit time.
    
    Following trivial patch removes it in that case:
    
    Index: generic/tclEvent.c
    ==================================================================
    --- generic/tclEvent.c
    +++ generic/tclEvent.c
    @@ -1297,22 +1297,24 @@
     	TclFinalizeIOSubsystem();
     	TclFinalizeNotifier();
     	TclFinalizeAsync();
     	TclFinalizeThreadObjects();
         }
    +    if (!TclInExit()) { /* useless if we are facing exit() */
     
    -    /*
    -     * Blow away all thread local storage blocks.
    -     *
    -     * Note that Tcl API allows creation of threads which do not use any Tcl
    -     * interp or other Tcl subsytems. Those threads might, however, use thread
    -     * local storage, so we must unconditionally finalize it.
    -     *
    -     * Fix [Bug #571002]
    -     */
    -
    -    TclFinalizeThreadData();
    +	/*
    +	 * Blow away all thread local storage blocks.
    +	 *
    +	 * Note that Tcl API allows creation of threads which do not use any Tcl
    +	 * interp or other Tcl subsytems. Those threads might, however, use thread
    +	 * local storage, so we must unconditionally finalize it.
    +	 *
    +	 * Fix [Bug #571002]
    +	 */
    +	
    +	TclFinalizeThreadData();
    +    }
     }
     
    
     /*
      *----------------------------------------------------------------------
      *
    
  2. login: "ferrieux"
  3. mimetype: "text/plain"