libcoro  1.0
Coroutine support library for C++20

◆ lock()

template<typename T , typename SubscribeFn = function<prepared_coro(promise<T>)>>
void coro::subscription< T, SubscribeFn >::lock ( lock_ptr &  ptr)
inline

subscribe and lock value during processing

Parameters
ptrpointer instance (initially initialized to nullptr). The function updates the pointer. It starts to point to the value. When pointer is held, the publisher is blocked. You can process the value, and need to use the pointer to subscribre for next value, which also unblock the publisher. If you drop the pointer, the publisher is also unblocked

Definition at line 157 of file subscription.h.