Skip to content

Commit

Permalink
Rename invalidate => destroy, relates #468
Browse files Browse the repository at this point in the history
  • Loading branch information
Neverlord committed Jun 6, 2016
1 parent 56e4193 commit ebc7bef
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion libcaf_core/caf/abstract_actor.hpp
Expand Up @@ -68,7 +68,7 @@ class abstract_actor : public abstract_channel {
/// 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;
Expand Down
2 changes: 1 addition & 1 deletion libcaf_core/caf/actor.hpp
Expand Up @@ -177,7 +177,7 @@ class actor : detail::comparable<actor>,

/// 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();
}

Expand Down
2 changes: 1 addition & 1 deletion libcaf_core/caf/actor_addr.hpp
Expand Up @@ -120,7 +120,7 @@ class actor_addr : detail::comparable<actor_addr>,

/// 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();
}

Expand Down
2 changes: 1 addition & 1 deletion libcaf_core/caf/actor_storage.hpp
Expand Up @@ -81,7 +81,7 @@ class actor_storage {
private:
static void data_dtor(abstract_actor* ptr) {
// safe due to static assert #3
ptr->destroy();
ptr->on_destroy();
static_cast<T*>(ptr)->~T();
}

Expand Down
2 changes: 1 addition & 1 deletion libcaf_core/caf/local_actor.hpp
Expand Up @@ -131,7 +131,7 @@ class local_actor : public monitorable_actor, public resumable {

~local_actor();

void destroy() override;
void on_destroy() override;

// -- spawn functions --------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion libcaf_core/caf/typed_actor.hpp
Expand Up @@ -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();
}

Expand Down
2 changes: 1 addition & 1 deletion libcaf_core/src/abstract_actor.cpp
Expand Up @@ -54,7 +54,7 @@ abstract_actor::~abstract_actor() {
// nop
}

void abstract_actor::destroy() {
void abstract_actor::on_destroy() {
// nop
}

Expand Down
6 changes: 3 additions & 3 deletions libcaf_core/src/group_manager.cpp
Expand Up @@ -281,9 +281,9 @@ class local_group_proxy : public local_group {
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:
Expand Down
4 changes: 2 additions & 2 deletions libcaf_core/src/local_actor.cpp
Expand Up @@ -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();
}
}

Expand Down
2 changes: 1 addition & 1 deletion libcaf_core/test/constructor_attach.cpp
Expand Up @@ -79,7 +79,7 @@ CAF_TEST(constructor_attach) {
}

void on_exit() {
invalidate(testee_);
destroy(testee_);
}

private:
Expand Down
4 changes: 2 additions & 2 deletions libcaf_core/test/dynamic_spawn.cpp
Expand Up @@ -514,7 +514,7 @@ CAF_TEST(constructor_attach) {
}

void on_exit() {
invalidate(buddy_);
destroy(buddy_);
}

private:
Expand Down Expand Up @@ -548,7 +548,7 @@ CAF_TEST(constructor_attach) {

void on_exit() {
CAF_MESSAGE("spawner::on_exit()");
invalidate(testee_);
destroy(testee_);
}

private:
Expand Down
2 changes: 1 addition & 1 deletion libcaf_io/src/middleman.cpp
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion libcaf_io/src/middleman_actor.cpp
Expand Up @@ -61,7 +61,7 @@ class middleman_actor_impl : public middleman_actor::base {

void on_exit() override {
CAF_LOG_TRACE("");
invalidate(broker_);
destroy(broker_);
}

const char* name() const override {
Expand Down
2 changes: 1 addition & 1 deletion libcaf_io/test/unpublish.cpp
Expand Up @@ -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);
}
Expand Down

0 comments on commit ebc7bef

Please sign in to comment.