ikrabbe / tclkit

Automatically exported from code.google.com/p/tclkit
1 stars 0 forks source link

Packages cannot be loaded in threads (tclkit 8.5.6 and 8.6b1) #3

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
It was a big surprise that my app working with TclKit 8.5.2 is no more
working on TclKit 8.6 (b1).
the following script

 #----------------------------------------
  # load http (or any other package) in main thread
 package require http
  # OK

  # now create a thread and load http in (or any other package)
 package require Thread

 set t0 [thread::create]
 thread::send $t0 {
   package require http
 }
   # OK in 8.5.2
   # KO in 8.6b1.
   # KO in 8.5.6
   #    Error is "can't find package http"
 #----------------------------------------

I noticed that in 8.6b1 thread "auto_path" is not set !
( in 8.5.2 it is correctly set)

Moreover,
in 8.6b1 running
   thread::send $t0 "namespace children ::"
returns
  ::thread ::tsv ::tpool ::oo ::tcl
whilst in 8.5.2 it returns:
  ::thread ::mk ::tsv ::tpool ::mk4vfs ::vfs ::tcl

I also tried to set auto_path in the t0 thread

 thread::send $t0 [list set ::auto_path $::auto_path]
 thread::send $t0 {
   package require http
 }
but result (in 8.6) is always "can't find package http"

** Is it a bug in 8.6 or is there something wrong with my code ?
**  In case of bug, is there a workaround ?

thanks for your help 

** Note:
Currently the official supported version on this site is 8.5.2 (and it works).
I downloaded 8.5.6 and 8.6b1 from Pat Thoyts's site.

Original issue reported on code.google.com by Aldo.w.buratti on 11 Apr 2009 at 10:58

GoogleCodeExporter commented 8 years ago
The fault here was in the kitgen build and the way that it initialized the tcl
interpreter. So anything built by me using kitgen suffered trouble with this. I 
have
since fixed it and included a test script so each release gets validated for a 
number
of similar problems.
8.5.7 is ok now and 8.5.8 will be ok too.

Original comment by pattho...@gmail.com on 11 Oct 2009 at 11:21