#{{{ method pause {}
#
# wait for a certain number of seconds
#
method pause {time} {
log "pausing for $time seconds"
set start $this(uptime)
set this(paused) true
after [expr $time * 1000] "
$this(this) eval set this(paused) false
"
while {$this(paused)} {
# sleep for 90 milliseconds to give the CPU a rest
# NB any longer would impair uptime counter
# Any shorter sends CPU usage too high!
after 90
this spinner
}
}
#}}}
#{{{ method spinner {}
#
# This displays a spinning symbol every time it is called
# it is based on the spinner variable which is updated at each call
#
method spinner {} {
set spin(0) "\\"
set spin(1) {-}
set spin(2) {/}
set spin(3) {|}
incr this(spinner)
puts -nonewline "\r $spin([expr $this(spinner)%4])\r"
flush stdout
}
#}}}