Skip to content
Tcl Source Code History Of Ticket 987967ffffffffffffffffffffffffffffffffff
Login

History Of Ticket 987967ffffffffffffffffffffffffffffffffff

Artifacts Associated With Ticket 987967ffffffffffffffffffffffffffffffffff

  1. Ticket change [b04f2a5d92] (rid 97957) by sorensenjs on 2004-07-09 13:51:30:

    1. assignee initialized to: "andreas_kupries"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized 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 initialized to: "obsolete: 8.5a1"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "sorensenjs"
    9. subsystem initialized to: "49. Threading"
    10. title initialized to: "CRITICAL_SECTION masterLock not initialized"
    11. type initialized to: "Bug"
  2. Ticket change [6a78594ffa] (rid 128154) by andreas_kupries on 2004-07-09 22:32:17:

    1. assignee changed to: "vasiljevic"
    2. icomment:
      Logged In: YES 
      user_id=75003
      
      Given to Zoran, he knows thread stuff better. Reprioritizing
      because of the possible seg.fault.
      
      
    3. login: "andreas_kupries"
    4. mimetype: "text/plain"
    5. priority changed to: "8"
    6. username: "andreas_kupries"
  3. Ticket change [72f9018533] (rid 104963) by dgp on 2004-07-10 06:08:15:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      
      I believe this is just failure to
      call Tcl_FindExecutable()
      in a slightly different variation
      from the usual.
      
      Add a Tcl_FindExecutable(NULL)
      to your program before any other
      calls into the Tcl library and see if that
      corrects the problem.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  4. Ticket change [7aa4841afb] (rid 90363) by vasiljevic on 2004-07-10 13:53:05:

    1. icomment:
      Logged In: YES 
      user_id=95086
      
      Yes. This is the probable cause. The fact is that we should be 
      really exposing a kind of Tcl_Initialize() call just to be symetric 
      to Tcl_Finalize(). This way people would have a clear idea 
      what to do when using the library services w/o actually  
      creating an interp. I do not know if this one needs a TIP. 
      I believe not. 
      
      
    2. login: "vasiljevic"
    3. mimetype: "text/plain"
    4. username: "vasiljevic"
  5. Ticket change [796918c47f] (rid 90123) by sorensenjs on 2004-07-11 19:04:09:

    1. icomment:
      Logged In: YES 
      user_id=1080292
      
      I concur with the comments and think that it would be a good
      thing to have an initialize function, although most of Tcl's
      code currently checks and performs initialization of static
      data through local test and set routines.
      
      On the other hand, the change I'm suggesting would make the
      windows code more like the unix code (which doesn't have
      this problem); would solve the immediate problem of using
      Tcl as a library without creating an interpreter (on
      windows); would not result in significant overhead; and
      finally, would only change this local file locally at
      compile time.  I cannot conceive of an argument against
      making this change.
      
      Specifically, the change is this
      > #define MASTER_LOCK EnterCriticalSection(&masterLock)
      > #define MASTER_UNLOCK LeaveCriticalSection(&masterLock)
      would become
      < #define MASTER_LOCK TclpMasterLock()
      < #define MASTER_UNLOCK TclpMasterUnlock()
      
      While I concur with dgp that there are many Tcl functions
      that could be called, perhaps most obviously
      Tcl_CreateInterp, that would perform this initialization,
      the documentation does not suggest that this should be
      required.  In fact, on unix, it does not seem to be required
      at all.  Perhaps this is not true if you call some deep Tcl
      functions.  The most likely library calls to be used in this
      fashion are Tcl_Obj manipulation, string handling esp.
      utf-8, and regular expressions.
      
       
      
      
    2. login: "sorensenjs"
    3. mimetype: "text/plain"
    4. username: "sorensenjs"
  6. Ticket change [a37c1ae3ff] (rid 110053) by vasiljevic on 2004-07-11 19:34:41:

    1. icomment:
      Logged In: YES 
      user_id=95086
      
      Whats wrong with 
      void Tcl_Initialize(void)  
      { 
          TclInitSubsystems(NULL); 
      } 
       
      This takes care about all subsystems in Tcl. After this call 
      everything including the object system, notifier thread, 
      encoding system etc etc are properly setup w/o need to 
      call Tcl_CreateInterp or Tcl_FindExecutable. This would 
      benefit the Tcl API better in terms of symetry. 
       
      Besides, there is nothing wrong with your proposal  
       
      > #define MASTER_LOCK EnterCriticalSection(&masterLock) 
      > #define MASTER_UNLOCK LeaveCriticalSection(&masterLock) 
      would become 
      < #define MASTER_LOCK TclpMasterLock() 
      < #define MASTER_UNLOCK TclpMasterUnlock() 
       
      This seems ok on the first glance. 
       
       
      
      
    2. login: "vasiljevic"
    3. mimetype: "text/plain"
    4. username: "vasiljevic"
  7. Ticket change [5826235fff] (rid 117752) by dgp on 2004-07-11 22:48:06:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      All sounds fine to me.  I'd say
      the MASTER_LOCK changes could
      go in for both 8.4.7 and 8.5.  That
      would solve the immediate issue, right?
      
      A Tcl_Initialize() routine also sounds
      promising, but will need a TIP.
      
      See also Patch 9876520 for other work
      in progress on reforming Tcl's startup
      sequence.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  8. Ticket change [03e7a9eeac] (rid 119905) by vasiljevic on 2004-07-20 02:24:06:

    1. closedate changed to: "2004-07-19T19:24:06"
    2. closer changed to: "vasiljevic"
    3. icomment:
      Logged In: YES 
      user_id=95086
      
      Applied to both core-8-4-branch and head.
      Jeffrey, can you please checkout and try this on Win?
      Thanks.
      
      
    4. login: "vasiljevic"
    5. mimetype: "text/plain"
    6. resolution changed to: "Accepted"
    7. status changed to: "Closed"
    8. username: "vasiljevic"
  9. Ticket change [14a6043cb3] (rid 124431) by hobbs on 2004-07-20 03:31:16:

    1. icomment:
      Logged In: YES 
      user_id=72656
      
      Passes all tests for core-8-4-branch Win XP VC++ 6 build
      with --enable-threads --enable-symbols=all.
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. username: "hobbs"