![]() |
Bitcoin Core 29.99.0
P2P Digital Currency
|
Customizable (through template specialization) base class which ProxyServer classes produced by generated code will inherit from. More...
#include <proxy.h>
Additional Inherited Members | |
![]() | |
using | Interface = Interface |
using | Impl = Impl |
![]() | |
ProxyServerBase (std::shared_ptr< Impl > impl, Connection &connection) | |
virtual | ~ProxyServerBase () |
ProxyServer destructor, called from the EventLoop thread by Cap'n Proto garbage collection code after there are no more references to this object. More... | |
void | invokeDestroy () |
If the capnp interface defined a special "destroy" method, as described the ProxyClientBase class, this method will be called and synchronously destroy m_impl before returning to the client. More... | |
![]() | |
std::shared_ptr< Impl > | m_impl |
Implementation pointer that may or may not be owned and deleted when this capnp server goes out of scope. More... | |
ProxyContext | m_context |
Customizable (through template specialization) base class which ProxyServer classes produced by generated code will inherit from.
The default specialization of this class just inherits from ProxyServerBase, but custom specializations can be defined to control ProxyServer behavior.
Specifically, it can be useful to specialize this class to add additional state to ProxyServer classes, for example to cache state between IPC calls. If this is done, however, care should be taken to ensure that the extra state can be destroyed without blocking, because ProxyServer destructors are called from the EventLoop thread, and if they block, it could deadlock the program. One way to do avoid blocking is to clean up the state by pushing cleanup callbacks to the m_context.cleanup_fns list, which run after the server m_impl object is destroyed on the same thread destroying it (which will either be an IPC worker thread if the ProxyServer is being explicitly destroyed by a client calling a destroy() method with a Context argument and Context.thread value set, or the temporary EventLoop::m_async_thread used to run destructors without blocking the event loop when no-longer used server objects are garbage collected by Cap'n Proto.) Alternately, if cleanup needs to run before m_impl is destroyed, the specialization can override invokeDestroy and destructor methods to do that.