|
template<typename Message , typename... Args> |
SO_5_NODISCARD timer_id_t | send_periodic (so_5::environment_t &env, const so_5::mbox_t &to, std::chrono::steady_clock::duration pause, std::chrono::steady_clock::duration period, Args &&... args) |
| A utility function for creating and delivering a periodic message. More...
|
|
template<typename Message , typename Target , typename... Args> |
SO_5_NODISCARD timer_id_t | send_periodic (Target &&target, std::chrono::steady_clock::duration pause, std::chrono::steady_clock::duration period, Args &&... args) |
| A utility function for creating and delivering a periodic message to the specified destination. More...
|
|
template<typename Message > |
SO_5_NODISCARD std::enable_if< !::so_5::is_signal< Message >::value, timer_id_t >::type | send_periodic (::so_5::environment_t &env, const ::so_5::mbox_t &to, std::chrono::steady_clock::duration pause, std::chrono::steady_clock::duration period, ::so_5::mhood_t< Message > mhood) |
| A utility function for delivering a periodic from an existing message hood. More...
|
|
template<typename Message > |
SO_5_NODISCARD std::enable_if< ::so_5::is_signal< Message >::value, timer_id_t >::type | send_periodic (::so_5::environment_t &env, const ::so_5::mbox_t &to, std::chrono::steady_clock::duration pause, std::chrono::steady_clock::duration period, ::so_5::mhood_t< Message >) |
| A utility function for periodic redirection of a signal from existing message hood. More...
|
|
template<typename Message , typename Target > |
SO_5_NODISCARD timer_id_t | send_periodic (Target &&target, std::chrono::steady_clock::duration pause, std::chrono::steady_clock::duration period, ::so_5::mhood_t< Message > mhood) |
| A helper function for redirection of a message/signal as a periodic message/signal. More...
|
|
template<typename Message , typename... Args> |
SO_5_NODISCARD timer_id_t | send_delayed (so_5::environment_t &env, const so_5::mbox_t &to, std::chrono::steady_clock::duration pause, Args &&... args) |
| A utility function for creating and delivering a delayed message. More...
|
|
template<typename Message , typename Target , typename... Args> |
SO_5_NODISCARD timer_id_t | send_delayed (Target &&target, std::chrono::steady_clock::duration pause, Args &&... args) |
| A utility function for creating and delivering a delayed message to the specified destination. More...
|
|
template<typename Message > |
SO_5_NODISCARD timer_id_t | send_delayed (so_5::environment_t &env, const so_5::mbox_t &to, std::chrono::steady_clock::duration pause, ::so_5::mhood_t< Message > cmd) |
| A helper function for redirection of existing message/signal as delayed message. More...
|
|
template<typename Message , typename Target > |
SO_5_NODISCARD timer_id_t | send_delayed (Target &&target, std::chrono::steady_clock::duration pause, ::so_5::mhood_t< Message > cmd) |
| A helper function for redirection of existing message/signal as delayed message. More...
|
|
template<typename Message , typename Target , typename... Args>
SO_5_NODISCARD timer_id_t so_5::extra::revocable_timer::send_delayed |
( |
Target && |
target, |
|
|
std::chrono::steady_clock::duration |
pause, |
|
|
Args &&... |
args |
|
) |
| |
A utility function for creating and delivering a delayed message to the specified destination.
Agent, ad-hoc agent or mchain can be used as target.
- Note
- Message chains with overload control must be used for periodic messages with additional care because exceptions can't be thrown during dispatching messages from timer.
This function is intended to be used inside SObjectizer's agents where we have this
pointer and can extract reference to SObjectizer Environment and the direct mbox of agent from that pointer:
class my_agent : public so_5::agent_t {
timer_ns::timer_id_t timer_;
...
void so_evt_start() override {
...
timer_ = timer_ns::send_periodic<kill_youself>(*this, 60s, ...);
...
}
...
};
- Note
- The return value of that function must be stored somewhere. Otherwise the delayed timer will be cancelled automatically just right after send_delayed returns.
- Attention
- Value of pause should be non-negative.
- Template Parameters
-
Message | type of message or signal to be sent. |
Target | can be so_5::agent_t, so_5::adhoc_agent_definition_proxy_t or so_5::mchain_t. |
Args | list of arguments for Message's constructor. |
- Since
- v.1.2.0
- Parameters
-
target | A destination for the periodic message. |
pause | Pause for message delaying. |
args | Message constructor parameters. |
Definition at line 750 of file pub.hpp.
template<typename Message , typename Target , typename... Args>
SO_5_NODISCARD timer_id_t so_5::extra::revocable_timer::send_periodic |
( |
Target && |
target, |
|
|
std::chrono::steady_clock::duration |
pause, |
|
|
std::chrono::steady_clock::duration |
period, |
|
|
Args &&... |
args |
|
) |
| |
A utility function for creating and delivering a periodic message to the specified destination.
Agent, ad-hoc agent or mchain can be used as target.
- Note
- Message chains with overload control must be used for periodic messages with additional care because exceptions can't be thrown during dispatching messages from timer.
This function is intended to be used inside SObjectizer's agents where we have this
pointer and can extract reference to SObjectizer Environment and the direct mbox of agent from that pointer:
class my_agent : public so_5::agent_t {
timer_ns::timer_id_t timer_;
...
void so_evt_start() override {
...
timer_ = timer_ns::send_periodic<do_some_task>(*this, 1s, 1s, ...);
...
}
...
};
- Note
- The return value of that function must be stored somewhere. Otherwise the periodic timer will be cancelled automatically just right after send_periodic returns.
- Attention
- Values of pause and period should be non-negative.
- Template Parameters
-
Message | type of message or signal to be sent. |
Target | can be so_5::agent_t, so_5::adhoc_agent_definition_proxy_t or so_5::mchain_t. |
Args | list of arguments for Message's constructor. |
- Since
- v.1.2.0
- Parameters
-
target | A destination for the periodic message. |
pause | Pause for message delaying. |
period | Period of message repetitions. |
args | Message constructor parameters. |
Definition at line 427 of file pub.hpp.