libcoro  1.0
Coroutine support library for C++20

◆ init_lock() [2/2]

template<typename T , typename SubscribeFn = function<prepared_coro(promise<T>)>>
static constexpr lock_ptr coro::subscription< T, SubscribeFn >::init_lock ( std::atomic< bool > &  unlock)
inlinestaticconstexpr

initialize lock_ptr, set atomic variable, which receives signal once the thread starts waiting on a subscription

Parameters
unlockreference to atomic variable, which is set to true when lock() is called with returned object
Returns
instance of lock_ptr which can be used in lock() function
Note
accessing the contentent of such instance is UB. You only allowed to call lock() to retrieve content

Definition at line 144 of file subscription.h.