![]() |
Bitcoin Core 29.99.0
P2P Digital Currency
|
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 |
Mutex mainly used internally by waiter class, but also used externally to guard access to related state. More... | |
std::condition_variable | m_cv |
std::optional< kj::Function< void()> > | m_fn |
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 271 of file proxy-io.h.
|
default |
|
inline |
|
inline |
std::condition_variable mp::Waiter::m_cv |
Definition at line 311 of file proxy-io.h.
std::optional<kj::Function<void()> > mp::Waiter::m_fn |
Definition at line 312 of file proxy-io.h.
std::mutex mp::Waiter::m_mutex |
Mutex mainly used internally by waiter class, but also used externally to guard access to related state.
Specifically, since the thread_local ThreadContext struct owns a Waiter, the Waiter::m_mutex is used to guard access to other parts of the struct to avoid needing to deal with more mutexes than necessary. This mutex can be held at the same time as EventLoop::m_mutex as long as Waiter::mutex is locked first and EventLoop::m_mutex is locked second.
Definition at line 310 of file proxy-io.h.