Ultimately, what I'm trying to set up is queuing system (although
nothing quite so...rigorous). I'd like to be able to arrange some
input for the FORTRAN, send it on its merry way, along with some
instructions regarding what to do when it finishes, and then arrange
some more input (without the 5 minute wait).
Is there a way to spawn off separate instances of a procedure within
TCL? I realize that this could be potentially dangerous territory if
the spawning procedure has any reach back to its originating
namespace. Hopefully I've explained things well enough.
Can anyone think of a different (better?) way of tackling this?
Thanks, this group really is a tremendous resource for us amateurs.
Greg
1. Setup event driven read/write from a pipe. This may be done by
using "exec" with redirections or by using open "|fortranprogram" "r+" ,
both times involving the "fileevent" command. This is the method I prefer,
as there is *no* concurrency. There is only one execution path at a time,
new events are only processed when then current code snippet finished its
work and returned to the event loop.
2. Enabling Tcl threading and open a second interpreter (==thread) for the
exec call. This solution seems simple but gives you all the hurtings of
permanent concurrency, as it affects *all* interpreters.
Kind regards
Jan
Look at the fileevent example by Kevin Kenny on this page:
http://wiki.tcl.tk/880
Maybe also useful:
http://wiki.tcl.tk/3359
http://wiki.tcl.tk/4004
http://wiki.tcl.tk/8507
Michael
uwe
Read up on the after command:
http://www.tcl.tk/man/tcl8.4/TclCmd/after.htm
proc long_command {} {
puts starting...
after 5000
puts ...done
}
puts "invoking long_command in the background"
after 0 long_command
puts "long_command launched."
--
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry