我正在尝试搜索信息,如果进程间通信可能发生在tcl线程中。我现在正在收集这方面的资料。我了解发送者和接收者机制被编码为在进程之间传递数据。而tcl线程包提供了发送命令。同样的,线程也可以用作spawn进程的定时器。 是否有可能从线程接收数据到另一个线程? 感谢你。如何使用tcl线程作为进程间通信方法?
#contains of test.tcl
puts stdout "hello from wish"
# end of file
# set cmd
set exe {wish85.exe}
set exepath [list $exe test.tcl]
# This next line is slightly magical
set f [open |$exepath r+]
# Use the next line or you'll regret it!
puts $f {fconfigure stdout -buffering line}
fileevent $f readable "getline $f"
proc getline f {
if {[gets $f line]<0} {
close $f ;
return ;
}
puts "line=$line"
}
谢谢......我更现在明白。一旦我准备好了,就会放在这里。 – OliveOne
如果执行exe没有stdout通道会怎么样? – OliveOne