Tcl question: fileevent: Does it block?
Joel Hammer
joel
Mon May 17 11:57:37 PDT 2004
Rank beginner here.
>From reading the documentation of fileevent, I got the impression it
simply registers a procedure with a file event and then the script moves
on. That isn't my experience.
This little snippet hangs at the fileevent line if there is no input in
the pipe. Once there is something to read in the pipe, the SomeProcedure
is called and processing of the script moves to the puts line after
the fileevent line. Additional input to the pipe is ignored. This is
like nothing I expected from reading the documentation. It makes the
fileevent command no better than a while loop.
BTW, I load the pipe with echo commands from another terminal.
Any insight appreciated.
Joel
#!/etc/alternatives/wish -f
set i 0
set id [ open /tmp/NewPipe r ]
fileevent $id readable [list SomeProcedure $id]
puts "beyond filevent"
More information about the Linux-users
mailing list