Module async::host
async: hosted parking and block_on
HostPark is the Park source (std/async/executor.h) for a hosted program with no I/O to wait for: the OS monotonic clock, and a condition variable to sleep on until the next timer deadline or a wake from another thread. block_on(&fut) runs a future to completion on the calling thread with a fresh LocalExecutor and a HostPark — the usual way into async code from main() (Rust's futures::executor::block_on):
struct Fetch f = Fetch::new();
int n = block_on(&f);
For async I/O use std/async/net.h's Runtime instead (its IoDriver parks in the OS readiness queue); for parallelism std/async/pool.h's ThreadPool. Hosted targets only (it uses std/thread.h and std/time.h).
Structs
| HostPark |
Functions
| async_mono_ms | Milliseconds of the OS monotonic clock. |
| block_on | Run 'fut' to completion on this thread and return its value. Tasks it spawns (async_spawn) run meanwhile, on the same thread; any still running when 'fut' finishes are abandoned with the executor. |