uvco 0.1
|
Concepts | |
concept | uvco::MainFunction |
Functions | |
Promise< void > | uvco::yield () |
Suspend current coroutine until next event loop iteration. | |
MultiPromise< unsigned > | uvco::yield (unsigned count) |
Generate count values from 0 to count - 1 . | |
template<typename R , MainFunction< R > F> | |
R | uvco::runMain (F main, Scheduler::RunMode mode=Scheduler::RunMode::Deferred) |
R uvco::runMain | ( | F | main, |
Scheduler::RunMode | mode | ||
) |
Set up event loop, then run main function to set up promises. Finally, clean up once the event loop has finished. An exception thrown within a coroutine is rethrown here.
MainFunction
is a function taking a single const Loop&
argument, and returning a Promise<R>
. The supplied Loop is necessary to instantiate different types of resources, such as TCP streams or timers.
Example:
Promise< void > uvco::yield | ( | ) |
Suspend current coroutine until next event loop iteration.
MultiPromise< unsigned > uvco::yield | ( | unsigned | count | ) |
Generate count
values from 0 to count - 1
.