rget(r, @optional timeout, default = false)
Return the object bound to the reactive variable r
.
If timeout
is not specified, rget
will wait till the reactive variable is bound by another task.
If timeout
is specified and the variable is not bound within it runs-out, rget
will return
the value of default
. If there are no other tasks running this function will raise
a "Deadlock detected" error.
The ?r
syntax has the same semantics as rget
with no
timeout
specified.
let x = ?
!{task_sleep(5); ?x = 100}
rget(x, 2) // wait for 2 seconds
// false
rget(x, 4) // wait for another 4 seconds, `x` should be bound by now.
// 100