CatapultServer  v0.5.0.1 (Elephant)
catapult::thread::StrandOwnerLifetimeExtender< TOwner > Class Template Reference

Wraps a strand and automatically augments handlers to extend the lifetime of an owning object. More...

Public Member Functions

 StrandOwnerLifetimeExtender (boost::asio::io_context::strand &strand)
 Creates a strand owner lifetime extender around strand. More...
 
template<typename THandler >
auto wrap (const std::shared_ptr< TOwner > &pOwner, THandler handler)
 Wraps handler and attaches pOwner to it. More...
 
template<typename THandler >
void post (const std::shared_ptr< TOwner > &pOwner, THandler handler)
 Attaches pOwner to handler and posts it to the strand. More...
 

Private Attributes

boost::asio::io_context::strand & m_strand
 

Detailed Description

template<typename TOwner>
class catapult::thread::StrandOwnerLifetimeExtender< TOwner >

Wraps a strand and automatically augments handlers to extend the lifetime of an owning object.

Constructor & Destructor Documentation

◆ StrandOwnerLifetimeExtender()

template<typename TOwner>
catapult::thread::StrandOwnerLifetimeExtender< TOwner >::StrandOwnerLifetimeExtender ( boost::asio::io_context::strand &  strand)
inlineexplicit

Creates a strand owner lifetime extender around strand.

Member Function Documentation

◆ post()

template<typename TOwner>
template<typename THandler >
void catapult::thread::StrandOwnerLifetimeExtender< TOwner >::post ( const std::shared_ptr< TOwner > &  pOwner,
THandler  handler 
)
inline

Attaches pOwner to handler and posts it to the strand.

◆ wrap()

template<typename TOwner>
template<typename THandler >
auto catapult::thread::StrandOwnerLifetimeExtender< TOwner >::wrap ( const std::shared_ptr< TOwner > &  pOwner,
THandler  handler 
)
inline

Wraps handler and attaches pOwner to it.

Member Data Documentation

◆ m_strand

template<typename TOwner>
boost::asio::io_context::strand& catapult::thread::StrandOwnerLifetimeExtender< TOwner >::m_strand
private

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