Aria 2.0.0
C++23 MVVM framework (C++20 minimum) — reactive, coroutine-first, ABI-layered
Loading...
Searching...
No Matches
aria::async::WhenAnyAwaiter< T > Class Template Reference

Awaitable that resolves when ANY of the input Tasks completes (success or error). More...

#include <when_all.hpp>

Classes

struct  Result

Public Types

using ValueField

Public Member Functions

 WhenAnyAwaiter (std::vector< Task< T > > tasks)
bool await_ready () const noexcept
bool await_suspend (std::coroutine_handle<> caller) noexcept
Result await_resume ()

Detailed Description

template<typename T>
class aria::async::WhenAnyAwaiter< T >

Awaitable that resolves when ANY of the input Tasks completes (success or error).

Returns the index (and result) of whichever finished first.

Race contract:

  • Built on detail::RaceSlot — closes the await_suspend race window where a synchronously-completing task could resume the parent before await_suspend has stored the parent handle.
  • Late tasks (losers) silently drop their results; their detached driver coroutines continue to run to completion in the background and eventually self-destruct.
  • For cooperative cancellation of losers, see when_any_cancellable below — it accepts factories that take a CancellationToken.

Member Typedef Documentation

◆ ValueField

template<typename T>
using aria::async::WhenAnyAwaiter< T >::ValueField
Initial value:
std::conditional_t<std::is_void_v<T>,
std::monostate,
std::optional<T>>

Constructor & Destructor Documentation

◆ WhenAnyAwaiter()

template<typename T>
aria::async::WhenAnyAwaiter< T >::WhenAnyAwaiter ( std::vector< Task< T > > tasks)
inlineexplicit

Member Function Documentation

◆ await_ready()

template<typename T>
bool aria::async::WhenAnyAwaiter< T >::await_ready ( ) const
inlinenoexcept

◆ await_suspend()

template<typename T>
bool aria::async::WhenAnyAwaiter< T >::await_suspend ( std::coroutine_handle<> caller)
inlinenoexcept

◆ await_resume()

template<typename T>
Result aria::async::WhenAnyAwaiter< T >::await_resume ( )
inline

The documentation for this class was generated from the following file: