bool abstract_actor::unlink_from_impl(const actor_addr& other) { if (!other) return false; guard_type guard{m_mtx}; // remove_backlink returns true if this actor is linked to other auto ptr = detail::raw_access::get(other); if (!exited() && ptr->remove_backlink(address())) { auto i = std::find(m_links.begin(), m_links.end(), ptr); CPPA_REQUIRE(i != m_links.end()); m_links.erase(i); return true; } return false; }
bool abstract_actor::remove_link_impl(const actor_addr& other) { CAF_LOG_TRACE(CAF_TSARG(other)); if (other == invalid_actor_addr || other == this) { return false; } default_attachable::observe_token tk{other, default_attachable::link}; guard_type guard{mtx_}; // remove_backlink returns true if this actor is linked to other auto ptr = actor_cast<abstract_actor_ptr>(other); if (detach_impl(tk, attachables_head_, true) > 0) { // tell remote side to remove link as well ptr->remove_backlink(address()); return true; } return false; }