libcoro  1.0
Coroutine support library for C++20
Public Member Functions | Protected Member Functions | List of all members
coro::promise< T, atomic >::notify Class Reference

contain notification to be delivered to the asociated future More...

#include <future.h>

Public Member Functions

void cancel ()
 cancel the future resolution (notify still needs to be delivered) More...
 
void deliver ()
 deliver the notification now More...
 
template<std::invocable< function< prepared_coro()> > Fn>
void deliver (Fn &&fn)
 deliver notification through the function More...
 
std::coroutine_handle symmetric_transfer ()
 deliver the notification with ability to switch to the coroutine More...
 
 operator bool () const
 Determines, whether object carries deferred notification. More...
 
notify operator+ (notify &other)
 combine notification into one object More...
 
notifyoperator+= (notify &other)
 append a notification More...
 
notifyoperator+= (notify &&other)
 append a notification More...
 

Protected Member Functions

 notify (FutureType *fut)
 Construct deferred notify from future. More...
 

Detailed Description

template<typename T, bool atomic>
class coro::promise< T, atomic >::notify

contain notification to be delivered to the asociated future

By setting a value to a promise, it can cause that associated coroutine will be resumed. The place, where this happens can be unsuitable for such operation. This object can be used to schedule the notification about resolution of the future. By default, the notification is delivered in the destructor, however the object can be moved, or the notification can be delivered manually. This object can be also used in situation special for coroutines, such a function await_suspend() to support the symmetric transfer

Definition at line 91 of file future.h.


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