Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: b04f2a5d9297564d00d29149f07615f402dc96f9
Ticket: 987967ffffffffffffffffffffffffffffffffff
CRITICAL_SECTION masterLock not initialized
User & Date: sorensenjs on 2004-07-09 13:51:30
Changes

  1. assignee changed to: "andreas_kupries"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Tcl version - current and all inspected - seems to
    be a problem all the way back to introduction of
    tclWinThrd.c so all v8.0 onwards
    
    OS - Windows only problem, and only if Tcl interpreters
    are not created (ie using tcl as a C library)
    
    When Tcl is used as a library (e.g. for utf-8 or regexp
    functions) on the Windows platform and TCL_THREADS
    is defined during the build of Tcl, the functions will
    produce a seg fault when the 
    MASTER_LOCK
    macro is invoked because the masterLock variable has
    not been initialized.  This is not seen if Tcl_CreateInterp
    has been invoked because TclpInitLock is called
    by TclInitSubsystems.
    
    However, the Tcl_RegExpCompile, for example is 
    supposed to be callable with the Tcl_Interp parameter
    set to NULL (0).
    
    In the unix implementation, the corresponding variable
    is initialized at compile time through a static initializer
    static pthread_mutex_t masterLock = 
    PTHREAD_MUTEX_INITIALIZER;
    this cannot be done on windows because a call
    to InitializeCriticalSection is required.
    
    One possible fix is change the macro for MASTER_LOCK
    to call the TclpMasterLock function in tclWinThrd.c
    This seems reasonable and it only affects this one file.
    
    In the meantime, it appears that a call to Tcl_GetTime
    will initialize the masterLock mutex.
    
    
  4. foundin changed to: "obsolete: 8.5a1"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "sorensenjs"
  9. subsystem changed to: "49. Threading"
  10. title changed to: "CRITICAL_SECTION masterLock not initialized"
  11. type changed to: "Bug"