am_holding_async_lock () returns true if the currently running thread is holding the
deferred () returns
(d, fill) where
d is a deferred that will become determined
fill v is called.
It is ok to call
deferred from inside or outside Async.
fill must be called from
run_in_async_with_optional_cycle f acquires the Async lock and runs
f () while
holding the lock. Depending on the result of
f, it may also run a cycle.
run_in_async f acquires the Async lock and runs
f () while holding the lock. It
returns the result of
f () to the outside world. The scheduler is woken up to
ensures the code that depends on
f () is run soon enough.
run_in_async doesn't run a cycle.
run_in_async does not automatically start the Async scheduler. You still need to
Scheduler.go elsewhere in your program.
block_on_async f runs
f () in the Async world and blocks until the result becomes
determined. This function can be called from the main thread (before Async is
started) or from a thread outside Async.
block_on_async will run a cycle if the deferred isn't determined, in the hope that
running the cycle will cause the deferred to become determined.
block_on_async will automatically start the scheduler if it isn't already