Commit d7f07ff4 authored by Dominik Charousset's avatar Dominik Charousset

Remove `virtual` keyword from `cleanup`

At the time `cleanup` is called, the most derived class is already known and
hiding is perfectly fine to achieve the same behavior. Relates #180.
parent 05c294db
......@@ -239,7 +239,7 @@ class abstract_actor : public abstract_channel {
* Called by the runtime system to perform cleanup actions for this actor.
* Subtypes should always call this member function when overriding it.
*/
virtual void cleanup(uint32_t reason);
void cleanup(uint32_t reason);
bool establish_link_impl(const actor_addr& other);
......
......@@ -506,7 +506,7 @@ class local_actor : public extend<abstract_actor>::with<mixin::memory_cached> {
m_planned_exit_reason = value;
}
void cleanup(uint32_t reason) override;
void cleanup(uint32_t reason);
inline mailbox_element* dummy_node() {
return &m_dummy_node;
......
......@@ -49,7 +49,7 @@ class mailbox_based : public Base {
return mailbox_element::create(std::forward<Ts>(args)...);
}
void cleanup(uint32_t reason) override {
void cleanup(uint32_t reason) {
detail::sync_request_bouncer f{reason};
m_mailbox.close(f);
Base::cleanup(reason);
......
......@@ -379,7 +379,7 @@ class broker : public extend<local_actor>::
protected:
broker();
void cleanup(uint32_t reason) override;
void cleanup(uint32_t reason);
using scribe_pointer = intrusive_ptr<scribe>;
......
......@@ -42,11 +42,8 @@ class middleman;
class sync_request_info : public extend<memory_managed>::
with<mixin::memory_cached> {
friend class detail::memory;
public:
using pointer = sync_request_info*;
~sync_request_info();
......@@ -56,30 +53,19 @@ class sync_request_info : public extend<memory_managed>::
message_id mid; // sync message ID
private:
sync_request_info(actor_addr sptr, message_id id);
};
class remote_actor_proxy : public actor_proxy {
using super = actor_proxy;
public:
remote_actor_proxy(actor_id mid, node_id pinfo,
actor parent);
void enqueue(const actor_addr&, message_id, message,
execution_unit*) override;
void enqueue(const actor_addr&, message_id,
message, execution_unit*) override;
void link_to(const actor_addr& other) override;
void unlink_from(const actor_addr& other) override;
bool remove_backlink(const actor_addr& to) override;
bool establish_backlink(const actor_addr& to) override;
bool link_impl(linking_operation op, const actor_addr& other) override;
void local_link_to(const actor_addr& other) override;
......@@ -88,16 +74,11 @@ class remote_actor_proxy : public actor_proxy {
void kill_proxy(uint32_t reason) override;
protected:
~remote_actor_proxy();
private:
void forward_msg(const actor_addr& sender, message_id mid,
message msg);
void forward_msg(const actor_addr& sender, message_id mid, message msg);
actor m_parent;
};
using remote_actor_proxy_ptr = intrusive_ptr<remote_actor_proxy>;
......
......@@ -72,24 +72,27 @@ void remote_actor_proxy::enqueue(const actor_addr& sender, message_id mid,
forward_msg(sender, mid, std::move(m));
}
void remote_actor_proxy::link_to(const actor_addr& other) {
if (link_to_impl(other)) {
bool remote_actor_proxy::link_impl(linking_operation op,
const actor_addr& other) {
switch (op) {
case establish_link_op:
if (establish_link_impl(other)) {
// causes remote actor to link to (proxy of) other
// receiving peer will call: this->local_link_to(other)
forward_msg(address(), message_id::invalid,
make_message(atom("_Link"), other));
return true;
}
}
void remote_actor_proxy::unlink_from(const actor_addr& other) {
if (unlink_from_impl(other)) {
return false;
case remove_link_op:
if (remove_link_impl(other)) {
// causes remote actor to unlink from (proxy of) other
forward_msg(address(), message_id::invalid,
make_message(atom("_Unlink"), other));
return true;
}
}
bool remote_actor_proxy::establish_backlink(const actor_addr& other) {
return false;
case establish_backlink_op:
if (super::establish_backlink(other)) {
// causes remote actor to unlink from (proxy of) other
forward_msg(address(), message_id::invalid,
......@@ -97,9 +100,7 @@ bool remote_actor_proxy::establish_backlink(const actor_addr& other) {
return true;
}
return false;
}
bool remote_actor_proxy::remove_backlink(const actor_addr& other) {
case remove_backlink_op:
if (super::remove_backlink(other)) {
// causes remote actor to unlink from (proxy of) other
forward_msg(address(), message_id::invalid,
......@@ -107,14 +108,16 @@ bool remote_actor_proxy::remove_backlink(const actor_addr& other) {
return true;
}
return false;
}
return false;
}
void remote_actor_proxy::local_link_to(const actor_addr& other) {
link_to_impl(other);
establish_link_impl(other);
}
void remote_actor_proxy::local_unlink_from(const actor_addr& other) {
unlink_from_impl(other);
remove_link_impl(other);
}
void remote_actor_proxy::kill_proxy(uint32_t reason) {
......
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