Commit ebc7bef1 authored by Dominik Charousset's avatar Dominik Charousset

Rename `invalidate => destroy`, relates #468

parent 56e41930
...@@ -68,7 +68,7 @@ public: ...@@ -68,7 +68,7 @@ public:
/// in sub classes before destroying the object, because calling /// in sub classes before destroying the object, because calling
/// virtual function in the destructor itself is not safe. Any override /// virtual function in the destructor itself is not safe. Any override
/// implementation is required to call `super::destroy()` at the end. /// implementation is required to call `super::destroy()` at the end.
virtual void destroy(); virtual void on_destroy();
void enqueue(strong_actor_ptr sender, message_id mid, void enqueue(strong_actor_ptr sender, message_id mid,
message content, execution_unit* host) override; message content, execution_unit* host) override;
......
...@@ -177,7 +177,7 @@ public: ...@@ -177,7 +177,7 @@ public:
/// Releases the reference held by handle `x`. Using the /// Releases the reference held by handle `x`. Using the
/// handle after invalidating it is undefined behavior. /// handle after invalidating it is undefined behavior.
friend void invalidate(actor& x) { friend void destroy(actor& x) {
x.ptr_.reset(); x.ptr_.reset();
} }
......
...@@ -120,7 +120,7 @@ public: ...@@ -120,7 +120,7 @@ public:
/// Releases the reference held by handle `x`. Using the /// Releases the reference held by handle `x`. Using the
/// handle after invalidating it is undefined behavior. /// handle after invalidating it is undefined behavior.
friend void invalidate(actor_addr& x) { friend void destroy(actor_addr& x) {
x.ptr_.reset(); x.ptr_.reset();
} }
......
...@@ -81,7 +81,7 @@ public: ...@@ -81,7 +81,7 @@ public:
private: private:
static void data_dtor(abstract_actor* ptr) { static void data_dtor(abstract_actor* ptr) {
// safe due to static assert #3 // safe due to static assert #3
ptr->destroy(); ptr->on_destroy();
static_cast<T*>(ptr)->~T(); static_cast<T*>(ptr)->~T();
} }
......
...@@ -131,7 +131,7 @@ public: ...@@ -131,7 +131,7 @@ public:
~local_actor(); ~local_actor();
void destroy() override; void on_destroy() override;
// -- spawn functions -------------------------------------------------------- // -- spawn functions --------------------------------------------------------
......
...@@ -252,7 +252,7 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>, ...@@ -252,7 +252,7 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>,
/// Releases the reference held by handle `x`. Using the /// Releases the reference held by handle `x`. Using the
/// handle after invalidating it is undefined behavior. /// handle after invalidating it is undefined behavior.
friend void invalidate(typed_actor& x) { friend void destroy(typed_actor& x) {
x.ptr_.reset(); x.ptr_.reset();
} }
......
...@@ -54,7 +54,7 @@ abstract_actor::~abstract_actor() { ...@@ -54,7 +54,7 @@ abstract_actor::~abstract_actor() {
// nop // nop
} }
void abstract_actor::destroy() { void abstract_actor::on_destroy() {
// nop // nop
} }
......
...@@ -281,9 +281,9 @@ public: ...@@ -281,9 +281,9 @@ public:
void stop() override { void stop() override {
CAF_LOG_TRACE(""); CAF_LOG_TRACE("");
await_all_locals_down(system_, {monitor_, proxy_broker_, broker_}); await_all_locals_down(system_, {monitor_, proxy_broker_, broker_});
invalidate(monitor_); destroy(monitor_);
invalidate(proxy_broker_); destroy(proxy_broker_);
invalidate(broker_); destroy(broker_);
} }
private: private:
......
...@@ -206,12 +206,12 @@ local_actor::~local_actor() { ...@@ -206,12 +206,12 @@ local_actor::~local_actor() {
private_thread_->notify_self_destroyed(); private_thread_->notify_self_destroyed();
} }
void local_actor::destroy() { void local_actor::on_destroy() {
CAF_LOG_TRACE(CAF_ARG(is_terminated())); CAF_LOG_TRACE(CAF_ARG(is_terminated()));
if (! is_cleaned_up()) { if (! is_cleaned_up()) {
on_exit(); on_exit();
cleanup(exit_reason::unreachable, nullptr); cleanup(exit_reason::unreachable, nullptr);
monitorable_actor::destroy(); monitorable_actor::on_destroy();
} }
} }
......
...@@ -79,7 +79,7 @@ CAF_TEST(constructor_attach) { ...@@ -79,7 +79,7 @@ CAF_TEST(constructor_attach) {
} }
void on_exit() { void on_exit() {
invalidate(testee_); destroy(testee_);
} }
private: private:
......
...@@ -514,7 +514,7 @@ CAF_TEST(constructor_attach) { ...@@ -514,7 +514,7 @@ CAF_TEST(constructor_attach) {
} }
void on_exit() { void on_exit() {
invalidate(buddy_); destroy(buddy_);
} }
private: private:
...@@ -548,7 +548,7 @@ CAF_TEST(constructor_attach) { ...@@ -548,7 +548,7 @@ CAF_TEST(constructor_attach) {
void on_exit() { void on_exit() {
CAF_MESSAGE("spawner::on_exit()"); CAF_MESSAGE("spawner::on_exit()");
invalidate(testee_); destroy(testee_);
} }
private: private:
......
...@@ -313,7 +313,7 @@ void middleman::stop() { ...@@ -313,7 +313,7 @@ void middleman::stop() {
scoped_actor self{system(), true}; scoped_actor self{system(), true};
self->send_exit(manager_, exit_reason::user_shutdown); self->send_exit(manager_, exit_reason::user_shutdown);
self->wait_for(manager_); self->wait_for(manager_);
invalidate(manager_); destroy(manager_);
} }
void middleman::init(actor_system_config& cfg) { void middleman::init(actor_system_config& cfg) {
......
...@@ -61,7 +61,7 @@ public: ...@@ -61,7 +61,7 @@ public:
void on_exit() override { void on_exit() override {
CAF_LOG_TRACE(""); CAF_LOG_TRACE("");
invalidate(broker_); destroy(broker_);
} }
const char* name() const override { const char* name() const override {
......
...@@ -65,7 +65,7 @@ struct fixture { ...@@ -65,7 +65,7 @@ struct fixture {
~fixture() { ~fixture() {
anon_send_exit(testee, exit_reason::user_shutdown); anon_send_exit(testee, exit_reason::user_shutdown);
invalidate(testee); destroy(testee);
system.~actor_system(); system.~actor_system();
CAF_CHECK_EQUAL(s_dtor_called.load(), 2); CAF_CHECK_EQUAL(s_dtor_called.load(), 2);
} }
......
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