|
uvco 0.1
|
Namespaces | |
| namespace | uvco::detail |
Classes | |
| class | uvco::WaitPoint |
| class | uvco::TaskSet |
Functions | |
| Promise< void > | uvco::yield () |
| MultiPromise< unsigned > | uvco::yield (unsigned count) |
| Generate count values from 0 to count - 1. | |
| template<typename... PromiseTypes> | |
| Promise< std::vector< std::variant< PromiseTypes... > > > | uvco::waitAny (Promise< PromiseTypes > &...promises) |
| template<typename... PromiseTypes> | |
| Promise< std::vector< std::variant< PromiseTypes... > > > | uvco::race (Promise< PromiseTypes >... promises) |
| template<typename... PromiseTypes> | |
| Promise< void > | uvco::raceIgnore (Promise< PromiseTypes >... promises) |
| template<typename... PromiseTypes> | |
| Promise< std::tuple< typename detail::ReplaceVoid< PromiseTypes >::type... > > | uvco::waitAll (Promise< PromiseTypes >... promises) |
Functions and classes useful to combine promises and generators into higher-level items.
| Promise< std::vector< std::variant< PromiseTypes... > > > uvco::race | ( | Promise< PromiseTypes >... | promises | ) |
Like waitAny, but cancels all promises that were not ready in time. Returns a vector of the results that were ready first; most frequently, only one element will be set.
| Promise< void > uvco::raceIgnore | ( | Promise< PromiseTypes >... | promises | ) |
Wait on any promise to be ready, ignoring results. When any promise is ready, all others are dropped and cancelled. This is very useful to run background promises concurrently, stopping all of them once one of them finishes or fails.
| Promise< std::tuple< typename detail::ReplaceVoid< PromiseTypes >::type... > > uvco::waitAll | ( | Promise< PromiseTypes >... | promises | ) |
Wait for all promises to finish, returning all results in a tuple. In the returned tuple, any Promise<void> is represented by a Void struct, which is just an empty struct.
| Promise< std::vector< std::variant< PromiseTypes... > > > uvco::waitAny | ( | Promise< PromiseTypes > &... | promises | ) |
Wait on any of the promises to be ready. Returns a vector of variants of possible values; one for each supplied promise that became ready. Non-ready promises are not cancelled.
This can be called repeatedly to wait until all promises are ready.
waitAny() is only a wrapper around SelectSet.
| Promise< void > uvco::yield | ( | ) |
Suspend current coroutine until next event loop iteration. This is especially useful when running expensive computations during which I/O should still happen to avoid starving other tasks; or as replacement for short-duration sleeps.
| MultiPromise< unsigned > uvco::yield | ( | unsigned | count | ) |
Generate count values from 0 to count - 1.