Bitcoin Core 29.99.0
P2P Digital Currency
Public Member Functions | Public Attributes | List of all members
mp::Waiter Struct Reference

Single element task queue used to handle recursive capnp calls. More...

#include <proxy-io.h>

Public Member Functions

 Waiter ()=default
 
template<typename Fn >
void post (Fn &&fn)
 
template<class Predicate >
void wait (std::unique_lock< std::mutex > &lock, Predicate pred)
 

Public Attributes

std::mutex m_mutex
 
std::condition_variable m_cv
 
std::function< void()> m_fn
 

Detailed Description

Single element task queue used to handle recursive capnp calls.

(If server makes an callback into the client in the middle of a request, while client thread is blocked waiting for server response, this is what allows the client to run the request in the same thread, the same way code would run in single process, with the callback sharing same thread stack as the original call.

Definition at line 243 of file proxy-io.h.

Constructor & Destructor Documentation

◆ Waiter()

mp::Waiter::Waiter ( )
default

Member Function Documentation

◆ post()

template<typename Fn >
void mp::Waiter::post ( Fn &&  fn)
inline

Definition at line 248 of file proxy-io.h.

Here is the call graph for this function:

◆ wait()

template<class Predicate >
void mp::Waiter::wait ( std::unique_lock< std::mutex > &  lock,
Predicate  pred 
)
inline

Definition at line 257 of file proxy-io.h.

Member Data Documentation

◆ m_cv

std::condition_variable mp::Waiter::m_cv

Definition at line 278 of file proxy-io.h.

◆ m_fn

std::function<void()> mp::Waiter::m_fn

Definition at line 279 of file proxy-io.h.

◆ m_mutex

std::mutex mp::Waiter::m_mutex

Definition at line 277 of file proxy-io.h.


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