Commit 9625c7fe authored by Dominik Charousset's avatar Dominik Charousset

Add missing `delayed_send` overloads

parent 53f4dacb
......@@ -207,7 +207,8 @@ class local_actor : public abstract_actor, public resumable {
template <class... Ts>
void delayed_send(message_priority mp, const channel& dest,
const duration& rtime, Ts&&... xs) {
delayed_send_impl(mp, dest, rtime, make_message(std::forward<Ts>(xs)...));
delayed_send_impl(message_id::make(mp), dest, rtime,
make_message(std::forward<Ts>(xs)...));
}
/**
......@@ -215,10 +216,45 @@ class local_actor : public abstract_actor, public resumable {
*/
template <class... Ts>
void delayed_send(const channel& dest, const duration& rtime, Ts&&... xs) {
delayed_send_impl(message_priority::normal, dest, rtime,
delayed_send_impl(message_id::make(), dest, rtime,
make_message(std::forward<Ts>(xs)...));
}
/**
* Sends `{xs...}` delayed by `rtime` to `dest` using the priority `mp`.
*/
template <class... Sigs, class... Ts>
void delayed_send(message_priority mp, const typed_actor<Sigs...>& dest,
const duration& rtime, Ts&&... xs) {
using token =
detail::type_list<
typename detail::implicit_conversions<
typename std::decay<Ts>::type
>::type...>;
token tk;
check_typed_input(dest, tk);
delayed_send_impl(message_id::make(mp), actor_cast<abstract_channel*>(dest),
rtime, make_message(std::forward<Ts>(xs)...));
}
/**
* Sends `{xs...}` delayed by `rtime` to `dest` using the priority `mp`.
*/
template <class... Sigs, class... Ts>
void delayed_send(const typed_actor<Sigs...>& dest,
const duration& rtime, Ts&&... xs) {
using token =
detail::type_list<
typename detail::implicit_conversions<
typename std::decay<Ts>::type
>::type...>;
token tk;
check_typed_input(dest, tk);
delayed_send_impl(message_id::make(), actor_cast<abstract_channel*>(dest),
rtime, make_message(std::forward<Ts>(xs)...));
}
/****************************************************************************
* miscellaneous actor operations *
****************************************************************************/
......@@ -626,7 +662,7 @@ class local_actor : public abstract_actor, public resumable {
void send_impl(message_id mp, abstract_channel* dest, message what);
void delayed_send_impl(message_priority mid, const channel& whom,
void delayed_send_impl(message_id mid, const channel& whom,
const duration& rtime, message data);
std::function<void()> m_sync_failure_handler;
......@@ -655,14 +691,14 @@ inline void local_actor::delayed_send_tuple(message_priority mp,
const channel& whom,
const duration& rtime,
message data) {
delayed_send_impl(mp, actor_cast<abstract_channel*>(whom),
delayed_send_impl(message_id::make(mp), actor_cast<abstract_channel*>(whom),
rtime, std::move(data));
}
inline void local_actor::delayed_send_tuple(const channel& whom,
const duration& rtime,
message data) {
delayed_send_impl(message_priority::normal,
delayed_send_impl(message_id::make(),
actor_cast<abstract_channel*>(whom), rtime,
std::move(data));
}
......
......@@ -810,12 +810,8 @@ void local_actor::send_exit(const actor_addr& whom, uint32_t reason) {
exit_msg{address(), reason});
}
void local_actor::delayed_send_impl(message_priority prio, const channel& dest,
void local_actor::delayed_send_impl(message_id mid, const channel& dest,
const duration& rel_time, message msg) {
message_id mid;
if (prio == message_priority::high) {
mid = mid.with_high_priority();
}
auto sched_cd = detail::singletons::get_scheduling_coordinator();
sched_cd->delayed_send(rel_time, address(), dest, mid, std::move(msg));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment