Inside a pool task, mizu_current_pool() returns the pool handle of the
worker evaluating the task. Pass it to mizu_submit() for nested submission:
subtasks push onto the worker's own work-stealing deque, and a worker blocked
collecting them helps instead of sleeping. Outside a task, it returns NULL.
Details
The pool itself provides the handle around each task evaluation, so unlike a variable binding it cannot be shadowed by a task argument or a local assignment.
Examples
p <- mizu_pool()
t <- mizu_submit(p, {
s <- mizu_submit(mizu_current_pool(), x * 2L, x = x)
mizu_collect(s, timeout = 30)
}, x = 21L)
mizu_collect(t, timeout = 30)
#> [1] 42
mizu_pool_stop(p)