Am 23.06.16 um 10:31 schrieb
mark....@gmail.com:
> ---------------
> proc myproc {} {
> puts "hello"
> }
>
> set forever [eval myproc]
> catch {vwait forever}
>
> puts "the end"
> ---------------
>
> With a non-threaded Tcl, I see both output messages and the process exits.
What is the intent of the real script? Your demonstration can be shortened:
catch {vwait forever}
puts End
The reason for the differing behaviour is, that in non-threaded Tcl
vwait can detect that it would literally wait forever, because there are
no pending events, and throws an error instead:
% vwait forever
can't wait for variable "forever": would wait forever
The error is caught, and the script goes on. Note that "forever" must be
written to *while* vwait is waiting, not before. If you change to
after 0 { set forever now}
vwait forever
the after event will terminate the vwait in all builds of Tcl.
In threaded Tcl, a second thread could actually queue an event and thus
vwait can not decide that it is uselessly waiting for Godot.
In short, the program above has a bug. It asks to wait endlessly,
without any possibility to end and while doing nothing. The bug surfaces
in different ways for threaded/non-threaded Tcl.
Christian