Browse Source

wire interp_sync_package_paths into punk::repl safe repltype and zzzload loader thread

master
Julian Noble 2 weeks ago
parent
commit
51f744a17e
  1. 6
      src/modules/punk/repl-999999.0a1.0.tm
  2. 12
      src/modules/zzzload-999999.0a1.0.tm

6
src/modules/punk/repl-999999.0a1.0.tm

@ -3577,6 +3577,12 @@ namespace eval repl {
switch -- $repltype {
safe {
interp create -safe -- code
#propagate tm list, auto_path, and package prefer to the safe code interp.
#-libunknown is not used because safe interps cannot source arbitrary files;
#the epoch copy below remains for cooperative use if libunknown is later
#adapted for safe interps (see TODO at line ~3634).
package require punk::lib
catch {punk::lib::interp_sync_package_paths code}
code eval [list namespace eval ::punk::libunknown {}]
catch {
code eval [list set ::punk::libunknown::epoch $::punk::libunknown::epoch]

12
src/modules/zzzload-999999.0a1.0.tm

@ -63,9 +63,15 @@ namespace eval zzzload {
return $ver
}
if {$loader_tid eq ""} {
set loader_tid [thread::create -joinable -preserved]
#todo - set tcl::tm::list and ::auto_path in the loader thread to match the main thread.
#(startup process may have modified these paths)
#propagate tm list, auto_path, and package prefer to the loader thread
#so it can find the same packages as the parent interp.
if {![catch {package require punk::lib}]} {
set init_script [punk::lib::snapshot_package_paths]
set loader_tid [thread::create -joinable -preserved $init_script]
} else {
#punk::lib not available — fall back to bare thread
set loader_tid [thread::create -joinable -preserved]
}
}
if {![tsv::exists zzzload_pkg $pkgname]} {
#puts stderr "zzzload pkg_require $pkgname"

Loading…
Cancel
Save