mp-coro main
Coroutine support tools
Public Member Functions | Private Attributes | List of all members
when_all_sync Class Reference

#include <mp-coro/when_all.h>

Detailed Description

Definition at line 40 of file when_all.h.

+ Collaboration diagram for when_all_sync:

Public Member Functions

constexpr when_all_sync (std::size_t count) noexcept
 
 when_all_sync (when_all_sync &&other) noexcept
 
bool set_continuation (std::coroutine_handle<> cont)
 
void notify_awaitable_completed ()
 On completion of each task a counter is being decremented and if the continuation is already attached (a counter was decremented by set_continuation() it is being resumed. More...
 
bool is_ready () const
 

Private Attributes

std::atomic< std::size_t > counter_
 
std::coroutine_handle continuation_
 

Constructor & Destructor Documentation

◆ when_all_sync() [1/2]

constexpr when_all_sync ( std::size_t  count)
inlineconstexprnoexcept

Definition at line 45 of file when_all.h.

◆ when_all_sync() [2/2]

when_all_sync ( when_all_sync &&  other)
inlinenoexcept

Definition at line 47 of file when_all.h.

Member Function Documentation

◆ set_continuation()

bool set_continuation ( std::coroutine_handle<>  cont)
inline
Return values
falsewhen a continuation is being attached when all work is already done and the current coroutine should be resumed right away via Symmetric Control Transfer.

Definition at line 53 of file when_all.h.

◆ notify_awaitable_completed()

void notify_awaitable_completed ( )
inline

On completion of each task a counter is being decremented and if the continuation is already attached (a counter was decremented by set_continuation() it is being resumed.

Definition at line 61 of file when_all.h.

◆ is_ready()

bool is_ready ( ) const
inline
Return values
trueif the continuation is already assigned which means that someone already awaited for the awaitable completion.

Definition at line 68 of file when_all.h.

Member Data Documentation

◆ counter_

std::atomic<std::size_t> counter_
private

Definition at line 41 of file when_all.h.

◆ continuation_

std::coroutine_handle continuation_
private

Definition at line 42 of file when_all.h.


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