task_sleep(timeout)
Causes the current task to wait until timeout
is reached and return void
. This blocks the task
only if timeout
represents a point in the future. It is an error for timeout
to be an object other than a number.
Timeout
can be an exact integer to indicate seconds or a fractional number to indicate sub-second precision.
task(^() letfn loop (i = 10)
{ showln(i)
task_sleep(2)
loop(i + 1) })
//> 10
11
12
13
14
15
16
...