I need to have two-way communication between threads in Tcl, and all I can get is one way to pass parameters as my only communication channel master-> helper. Here is what I have:
proc ExecProgram { command } { if { [catch {open "| $command" RDWR} fd ] } { # # Failed, return error indication # error "$fd" } }
To call tclsh83, for example ExecProgram "tclsh83 testCases.tcl TestCase_01"
In the testCases.tcl file, I can use the passed in information. For instance:
set myTestCase [lindex $argv 0]
Inside testCases.tcl, I can put it on the handset:
puts "$myTestCase" flush stdout
And get what is put into the main thread using the process id:
gets $app line
... inside the loop.
This is not good. And not in two directions.
Does anyone know a simple way of bidirectional communication for tcl on Windows between two threads?
source share