#include <iostream>
{
public :
a_pinger_t( context_t ctx,
so_5::mbox_t mbox,
int pings_to_send )
, m_pings_left{ pings_to_send }
{}
{
}
{
send_ping();
}
private :
int m_pings_left;
void evt_pong(mhood_t< msg_pong >)
{
if( m_pings_left > 0 )
send_ping();
else
}
void send_ping()
{
--m_pings_left;
}
};
{
public :
{
[mbox]( mhood_t<msg_ping> ) {
} );
}
};
int main()
{
try
{
});
});
return 0;
}
catch( const std::exception & x )
{
std::cerr << "*** Exception caught: " << x.what() << std::endl;
}
return 2;
}
A helper header file for including all public SObjectizer stuff.
virtual void so_define_agent()
Hook on define agent for SObjectizer.
environment_t & so_environment() const noexcept
Access to the SObjectizer Environment which this agent is belong.
subscription_bind_t so_subscribe(const mbox_t &mbox_ref)
Initiate subscription.
virtual void so_evt_start()
Hook on agent start inside SObjectizer.
Agent * make_agent(Args &&... args)
Helper method for simplification of agents creation.
mbox_t create_mbox()
Create an anonymous MPMC mbox.
void stop() noexcept
Send a shutdown signal to the Run-Time.
decltype(auto) introduce_coop(Args &&... args)
Helper method for simplification of cooperation creation and registration.
A base class for agent signals.
std::enable_if< details::is_agent_method_pointer< details::method_arity::unary, Method_Pointer >::value, subscription_bind_t & >::type event(Method_Pointer pfn, thread_safety_t thread_safety=not_thread_safe)
Make subscription to the message.
@ mbox
The source is a mbox.
Private part of message limit implementation.
void launch(Init_Routine &&init_routine)
Launch a SObjectizer Environment with default parameters.
void send(Target &&to, Args &&... args)
A utility function for creating and delivering a message or a signal.