Posted to tcl by kyak at Thu Nov 08 17:18:27 GMT 2018view pretty

proc loop {} {
while {1} {
        #do stuff
        after 2000
}
}

loop
vwait forever

Comments

Posted by sebres at Thu Nov 08 17:31:39 GMT 2018 [text] [code]

you don't need pauses (after 2000), you should use events... like: proc do_stuff {args} { if 1 $args; # repeat this in 2 seconds: after 1000 [list do_stuff puts "next try ... [incr ::cntr]"]; } do_stuff puts "initial ..."; after 5000 {set forever stop}; vwait forever there is also many other events (chan readable/writable, etc) that can be processed similar way...