Posted to tcl by miguel at Sat Oct 28 19:20:04 GMT 2006view pretty

mig@ice:~$ cat /tmp/a
while 1 {puts a; after 1000}
mig@ice:~$ cat /tmp/b
while 1 {puts b; after 1000}
mig@ice:~$
mig@ice:~$ tclsh
% proc look f {puts [gets $f]}
% set a [open "|[info name] /tmp/a"]
file5
% set b [open "|[info name] /tmp/b"]
file6
%  fileevent $a readable [list look $a]; fileevent $b readable [list look $b]; vwait forever
b
a
b
a
b
a
b
a
b
...