I want to insert sleep for 30 second in my TCL script.
I tried using sleep command. but its not working. could any one of you help on this?
I want to insert sleep for 30 second in my TCL script.
I tried using sleep command. but its not working. could any one of you help on this?
You have to use
after 30000
The argument to after
is interpreted as milliseconds.
While asking a question, if you insert your code, that will be useful for others.
As previously stated by Donal Fellows in the comments, rcubefather's solution will halt event processing while sleeping.
Here's a slightly different approach I use is:
after 30000 set stop_wait &
vwait stop_wait
unset stop_wait
This will put the 'after 30000' command in background (&) waiting for 'stop_wait' variable to be set, while any other event processing will not be halted. This behavior is much more evident working with Tk GUI. However this will not prevent 'vwait' command from catching up the variable when set, allowing this portion of code to proceed. Not CPU intensive as well.
set stop_wait X; after 30000 {set stop_wait Y}; vwait stop_wait; unset stop_wait
–
Diencephalon If you are in a Linux environment, you can use any Linux command.
Example:
puts [date] ; exec sleep 10 ; puts [date]
will yield:
Mon Feb 24 10:09:08 IST 2020
Mon Feb 24 10:09:18 IST 2020
Just make sure you have such command by typing which sleep
in a Linux shell.
© 2022 - 2024 — McMap. All rights reserved.