Tcl Source Code

View Ticket
Login
Ticket UUID: 219243
Title: [thread extension] TclGetLibraryPath in core returns NULL fo
Type: Bug Created on: 2000-10-26 05:04:05
Submitter: nobody Assigned to: nobody
Subsystem: 49. Threading Severity:
Priority: 5 Medium Last modified: 2001-01-03 23:11:44
Status: Closed Closed by: dkf
Resolution: Fixed Closed on: 2001-01-03 16:11:44
Version: obsolete: 8.3
Description:
OriginalBugID: 5301 Bug
Version: 8.3
SubmitDate: '2000-05-01'
LastModified: '2000-06-06'
Severity: CRIT
Status: Assigned
Submitter: techsupp
ChangedBy: hobbs
RelatedBugIDs: 3876
OS: Windows 2000
FixedDate: '2000-10-25'
ClosedDate: '2000-10-25'


Name:
David Gravereaux

CVS:
April 28, 1am PST

Comments:
Do we need to use Tcl_FindExecutable to set all these pre-init things
    from a thread ???

ReproducibleScript:
set a breakpoint on line 640 of threadCmd.c 
   "result = Tcl_Init(tsdPtr->interp);"
and watch it return 1 (TCL_ERROR).

ObservedBehavior:
This at least shows the error as it was being hidden before.  The root
of the problem lies in TclGetLibraryPath returning an invalid pointer.

Patch:
*** generic/threadCmd.c2000/04/17 20:37:041.6
--- generic/threadCmd.c2000/04/29 09:30:21
***************
*** 636,643 ****
       */
  
      tsdPtr->interp = Tcl_CreateInterp();
!     result = Tcl_Init(tsdPtr->interp);
      result = Thread_Init(tsdPtr->interp);
  
      /*
--- 636,647 ----
       */
  
      tsdPtr->interp = Tcl_CreateInterp();
!     if ((result = Tcl_Init(tsdPtr->interp)) != TCL_OK) {
! Tcl_MutexLock(&threadMutex);
! ThreadErrorProc(tsdPtr->interp);
! Tcl_ExitThread(result);
!     }
      result = Thread_Init(tsdPtr->interp);
  
      /*

PatchFiles:
generic/threadCmd.c



Name:

David Gravereaux



CVS:

updated yesterday



Comments:

This is a more complete patch solution then before.



ReproducibleScript:

package require Thread 2.0

set id [thread::create]



ObservedBehavior:

Tcl_Init fails



Patch:

*** tcl/generic/tclEvent.c2000/04/18 23:10:041.8

--- tcl/generic/tclEvent.c2000/04/30 06:24:42

***************

*** 99,104 ****

--- 99,109 ----

  static Tcl_ThreadDataKey dataKey;

  

  /*

+  * Common string for the library path for sharing across threads

+  */

+ char *tclLibraryPathStr;

+ 

+ /*

   * Prototypes for procedures referenced only in this file:

   */

  

***************

*** 596,601 ****

--- 601,607 ----

  Tcl_DecrRefCount(tsdPtr->tclLibraryPath);

      }

      tsdPtr->tclLibraryPath = pathPtr;

+     tclLibraryPathStr = Tcl_GetStringFromObj(pathPtr, NULL);

  }

  

  /*

***************

*** 619,624 ****

--- 625,634 ----

  TclGetLibraryPath()

  {

      ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);

+ 

+     if (tsdPtr->tclLibraryPath == NULL) {

+ tsdPtr->tclLibraryPath = Tcl_NewStringObj(tclLibraryPathStr, -1);

+     }

      return tsdPtr->tclLibraryPath;

  }

  



*** thread/generic/threadCmd.c2000/04/17 20:37:041.6

--- thread/generic/threadCmd.c2000/04/29 09:30:21

***************

*** 636,643 ****

       */

  

      tsdPtr->interp = Tcl_CreateInterp();

!     result = Tcl_Init(tsdPtr->interp);

      result = Thread_Init(tsdPtr->interp);

  

      /*

--- 636,647 ----

       */

  

      tsdPtr->interp = Tcl_CreateInterp();

!     if ((result = Tcl_Init(tsdPtr->interp)) != TCL_OK) {

! Tcl_ConditionNotify(&ctrlPtr->condWait);

! ThreadErrorProc(tsdPtr->interp);

! Tcl_ExitThread(result);

!     }

      result = Thread_Init(tsdPtr->interp);

  

      /*



PatchFiles:

tcl/generic/tclEvent.c

    thread/generic/threadCmd.c



 

-- 06/06/2000 hobbs
User Comments:
davygrvy added on 2000-12-30 04:07:57:
this bug should be marked fixed.  It was added for 8.4a2

dkf added on 2001-01-03 23:11:44:
Anything to oblige...