Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
mp::ProxyServerCustom< Interface, Impl > Struct Template Reference

#include <proxy.h>

Inheritance diagram for mp::ProxyServerCustom< Interface, Impl >:
[legend]
Collaboration diagram for mp::ProxyServerCustom< Interface, Impl >:
[legend]

Additional Inherited Members

Public Types inherited from mp::ProxyServerBase< Interface, Impl >
using Interface
using Impl
Public Member Functions inherited from mp::ProxyServerBase< Interface, Impl >
 ProxyServerBase (std::shared_ptr< Impl > impl, Connection &connection)
virtual ~ProxyServerBase ()
void invokeDestroy ()
Public Attributes inherited from mp::ProxyServerBase< Interface, Impl >
std::shared_ptr< Implm_impl
 Implementation pointer that may or may not be owned and deleted when this capnp server goes out of scope.
ProxyContext m_context

Detailed Description

template<typename Interface, typename Impl>
struct mp::ProxyServerCustom< Interface, Impl >

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.

Definition at line 196 of file proxy.h.


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