C/C++ API Reference
Loading...
Searching...
No Matches
Combinators

Overview

Helpers for interacting with multiple pendables.

Classes

class  pw::async2::Joiner< Pendables >
 
class  pw::async2::JoinFuture< Futures >
 
class  pw::async2::Selector< Pendables >
 
class  pw::async2::SelectFuture< Futures >
 
struct  pw::async2::SelectResult< I, T >
 
struct  pw::async2::AllPendablesCompleted
 Indicates that every pendable within a Selector has completed. More...
 
class  pw::async2::WakerQueue< kCapacity >
 

Functions

template<typename... Pendables>
 pw::async2::Joiner (Pendables &&...) -> Joiner< Pendables... >
 
template<typename... Futures>
 pw::async2::JoinFuture (Futures &&...) -> JoinFuture< Futures... >
 
template<typename... Futures>
constexpr auto pw::async2::Join (Futures &&... futures)
 
template<typename... Pendables>
 pw::async2::Selector (Pendables &&...) -> Selector< Pendables... >
 
template<typename... Pendables>
auto pw::async2::SelectPendable (Context &cx, Pendables &&... pendables)
 
template<typename ResultVariant , typename AllPendablesCompletedHandler , typename... ReadyHandler>
void pw::async2::VisitSelectResult (ResultVariant &&variant, AllPendablesCompletedHandler &&on_all_pendables_completed, ReadyHandler &&... on_ready)
 
template<typename... Futures>
 pw::async2::SelectFuture (Futures &&...) -> SelectFuture< Futures... >
 
template<typename... Futures>
SelectFuture< Futures... > pw::async2::Select (Futures &&... futures)
 

Function Documentation

◆ Join()

template<typename... Futures>
constexpr auto pw::async2::Join ( Futures &&...  futures)
constexpr

Creates a future which pends the provided futures until all of them have completed.

When ready, the resulting future returns a tuple containing each future's output in the order the futures were provided.

◆ Select()

template<typename... Futures>
SelectFuture< Futures... > pw::async2::Select ( Futures &&...  futures)

Runs each of the provided futures, resolving once the first has completed.

As additional futures may have completed during the time between the first completion and the task running, Select returns a Future<OptionalTuple> which stores the results of all the sub-futures which managed to complete.

◆ SelectPendable()

template<typename... Pendables>
auto pw::async2::SelectPendable ( Context cx,
Pendables &&...  pendables 
)

Returns the result of the first of the provided pendables which completes.

This SelectPendable function is intended for single use only. To iterate over all ready pendables, use Selector directly.

◆ VisitSelectResult()

template<typename ResultVariant , typename AllPendablesCompletedHandler , typename... ReadyHandler>
void pw::async2::VisitSelectResult ( ResultVariant &&  variant,
AllPendablesCompletedHandler &&  on_all_pendables_completed,
ReadyHandler &&...  on_ready 
)

Helper for interacting with a ResultVariant returned by a call to Select. See Selector documentation for example usage.