libcoro  1.0
Coroutine support library for C++20
Public Member Functions | List of all members
coro::condition< T, Pred > Class Template Reference

await on a condition More...

#include <condition.h>

Inherits coro::_details::abstract_condition_awaiter.

Public Member Functions

 condition (T &var, Pred &&pred)
 constructor More...
 
bool await_ready () const
 co_await support More...
 
T & await_resume () const
 co_await support More...
 
bool await_suspend (std::coroutine_handle<> h)
 co_await support More...
 
T & wait ()
 Synchronous waiting, allows to condition be used in normal function. More...
 

Detailed Description

template<typename T, typename Pred>
class coro::condition< T, Pred >

await on a condition

Template Parameters
Ttype of shared variable to monitor
Preda predicate which tests the condition. The predicate must return true or false and it should test condition related to shared variable
co_await coro::condition(var, [&]{return var == value;});
await on a condition
Definition: condition.h:195

The coroutine is suspended until the condition is fullfilled.

See also
notify_condition
Note
The class is not MT Safe. The predicate should use proper synchronization if used in multiple threads

Definition at line 195 of file condition.h.


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