void send_as(const actor& from, const typed_actor<Sigs...>& to, Ts&&... xs) { using token = detail::type_list< typename detail::implicit_conversions< typename std::decay<Ts>::type >::type...>; token tk; check_typed_input(to, tk); send_as(from, message_priority::normal, actor_cast<channel>(to), std::forward<Ts>(xs)...); }
bool actor::link_to_impl(const actor_ptr& other) { if (other && other != this) { guard_type guard{m_mtx}; // send exit message if already exited if (exited()) { send_as(this, other, atom("EXIT"), exit_reason()); } // add link if not already linked to other // (checked by establish_backlink) else if (other->establish_backlink(this)) { m_links.push_back(other); return true; } } return false; }
bool actor::establish_backlink(const actor_ptr& other) { std::uint32_t reason = exit_reason::not_exited; if (other && other != this) { guard_type guard{m_mtx}; reason = m_exit_reason; if (reason == exit_reason::not_exited) { auto i = std::find(m_links.begin(), m_links.end(), other); if (i == m_links.end()) { m_links.push_back(other); return true; } } } // send exit message without lock if (reason != exit_reason::not_exited) { send_as(this, other, make_any_tuple(atom("EXIT"), reason)); } return false; }
void actor_ostream::redirect(const actor& src, std::string f, int flags) { send_as(src, detail::singletons::get_scheduling_coordinator()->printer(), redirect_atom::value, src.address(), std::move(f), flags); }
actor_ostream& actor_ostream::flush() { send_as(self_, printer_, flush_atom::value); return *this; }
actor_ostream& actor_ostream::write(std::string arg) { send_as(self_, printer_, add_atom::value, std::move(arg)); return *this; }
actor_ostream& actor_ostream::flush() { send_as(m_self, m_printer, atom("flush")); return *this; }
actor_ostream& actor_ostream::write(std::string arg) { send_as(m_self, m_printer, atom("add"), std::move(arg)); return *this; }
void anon_send(const channel& to, Ts&&... xs) { send_as(invalid_actor, message_priority::normal, to, std::forward<Ts>(xs)...); }
void anon_send(message_priority prio, const channel& to, Ts&&... xs) { send_as(invalid_actor, prio, to, std::forward<Ts>(xs)...); }
void send_as(const actor& from, const channel& to, Ts&&... xs) { send_as(from, message_priority::normal, to, std::forward<Ts>(xs)...); }