在TCL中使用线程的错误 - 线程中采购时没有此类可变错误

  • 本文关键字:线程 错误 TCL multithreading tcl
  • 更新时间 :
  • 英文 :


遇到错误,无法读取" chan",没有这样的变量,该变量包含在我要在另一个文件中的线程中采购的文件中,chan甚至都不在文件i中正在使用我的线程。

thread::send $function {
        source xyz
        source zyx
        source yzx
}

xyz包含一个与此文件无关的变量,但是在执行" procectureInotherfile"事件"完成" $ chan" $ chan"中,从" source xyz"内部调用了" chan" no the这样的变量。p>

chan甚至都不在我与线程一起使用的文件中。

到底:)您期望什么?您似乎以黑盒方式将某些现有的TCL脚本 source不符合其callee要求。

观看:

% package req Thread
2.8.2
% set fh [open "/tmp/foo.tcl" w]
file5
% puts $fh {puts $chan "hello world"}
% close $fh
% set t1 [thread::create]
tid0x700004a5c000
% thread::send $t1 { source /tmp/foo.tcl }
can't read "chan": no such variable
% thread::send $t1 { set chan stderr; source /tmp/foo.tcl }
hello world
% thread::release $t1
0
% exit

最新更新