uvco 0.1
Loading...
Searching...
No Matches
uvco::WaitPoint Class Reference

#include <combinators.h>

Classes

struct  WaitPointAwaiter_

Public Member Functions

 WaitPoint ()=default
 WaitPoint (const WaitPoint &)=delete
 WaitPoint (WaitPoint &&) noexcept=default
WaitPointoperator= (const WaitPoint &)=delete
WaitPointoperator= (WaitPoint &&) noexcept=default
 ~WaitPoint ()=default
size_t waiting () const
Promise< void > wait ()
void releaseOne ()
void releaseAll ()

Private Member Functions

void enqueue (std::coroutine_handle<> handle)

Private Attributes

std::deque< std::coroutine_handle<> > waiters_

Detailed Description

Allows an arbitrary number of coroutines to wait on another coroutine to fulfill it.

Constructor & Destructor Documentation

◆ WaitPoint() [1/3]

uvco::WaitPoint::WaitPoint ( )
default

◆ WaitPoint() [2/3]

uvco::WaitPoint::WaitPoint ( const WaitPoint & )
delete

◆ WaitPoint() [3/3]

uvco::WaitPoint::WaitPoint ( WaitPoint && )
defaultnoexcept

◆ ~WaitPoint()

uvco::WaitPoint::~WaitPoint ( )
default

Member Function Documentation

◆ enqueue()

void uvco::WaitPoint::enqueue ( std::coroutine_handle<> handle)
private
74 {
75 waiters_.push_back(handle);
76}
std::deque< std::coroutine_handle<> > waiters_
Definition combinators.h:130

◆ operator=() [1/2]

WaitPoint & uvco::WaitPoint::operator= ( const WaitPoint & )
delete

◆ operator=() [2/2]

WaitPoint & uvco::WaitPoint::operator= ( WaitPoint && )
defaultnoexcept

◆ releaseAll()

void uvco::WaitPoint::releaseAll ( )
68 {
69 while (!waiters_.empty()) {
70 releaseOne();
71 }
72}
void releaseOne()
Definition combinators.cc:60

◆ releaseOne()

void uvco::WaitPoint::releaseOne ( )
60 {
61 if (waiters_.empty()) {
62 return;
63 }
64 Loop::enqueue(waiters_.front());
65 waiters_.pop_front();
66}
static void enqueue(std::coroutine_handle<> handle)
Definition loop.cc:94

◆ wait()

Promise< void > uvco::WaitPoint::wait ( )
58{ co_await WaitPointAwaiter_{*this}; }
Definition combinators.cc:42

◆ waiting()

size_t uvco::WaitPoint::waiting ( ) const
inlinenodiscard
123{ return waiters_.size(); }

Member Data Documentation

◆ waiters_

std::deque<std::coroutine_handle<> > uvco::WaitPoint::waiters_
private

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