ark::async_context class

context for running async functions

The async_context could be bound to io objects, often as their first argument to static construct functions. Then if async io operations got completed, the callbacks would get invoked inside run() of the bound context.

Currently, only single-threaded context run() invocation is supported, however, calling its functions from other thread or submitting io operations is supported.

Constructors, destructors, conversion operators

async_context() noexcept
constructor

Public functions

auto init() -> result<void> noexcept
init the context
auto run() -> result<void> noexcept
start the event loop
void exit() noexcept
let run() successfully return
void exit(result<void> ret)
let run() return with given result

Function documentation

ark::async_context::async_context() noexcept

constructor

the default constructed async_context is in an unusable state, you'll have to call init() before doing anything

result<void> ark::async_context::run() noexcept

start the event loop

start the event loop on current thread, continuously wait for and process events, and invoke callbacks