Commit ebc7bef1 authored by Dominik Charousset's avatar Dominik Charousset

Rename `invalidate => destroy`, relates #468

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