IO service
The IO service is an user-provided class which manages waiting for events and waking up coroutines/operations based on them.
The IO service must provide one method: void wait(). This method is called when
there is no more work to do currently. It waits for any event to happen, and wakes
up the appropriate coroutine/operation which awaited the event.
Note: async::run and async::run_forever (see here)
take the IO service by value, not by reference.
Example
The following example shows the approximate call graph executing an event-loop-driven coroutine would take:
async::run(my_sender, my_io_service)my_operation = async::execution::connect(my_sender, internal_receiver)async::execution::start_inline(my_operation)my_operationstarts running...co_await some_evsome_evoperation is startedmy_io_service.add_waiter(this)
- (
async::execution::start_inlinereturnsfalse) my_io_service.wait()- IO service waits for event to happen...
waiters_.front()->complete()some_evoperation completesmy_operationresumesco_return 2async::execution::set_value_noinline(internal_receiver, 2)
return internal_receiver.value
- (
async::runreturns2)