Permalink
Browse files

renamed `quit_actor` to `send_exit`

  • Loading branch information...
1 parent f04d525 commit 682b0ee128663b99e12d04b6dfbda6e2f0189588 @Neverlord Neverlord committed Apr 3, 2013
Showing with 17 additions and 14 deletions.
  1. +7 −4 cppa/cppa.hpp
  2. +1 −1 unit_testing/ping_pong.cpp
  3. +7 −7 unit_testing/test_spawn.cpp
  4. +2 −2 unit_testing/test_sync_send.cpp
View
@@ -856,12 +856,15 @@ actor_ptr remote_actor(network::io_stream_ptr_pair connection);
void shutdown(); // note: implemented in singleton_manager.cpp
/**
- * @brief Causes @p whom to quit with @p reason.
- * @note Does nothing if <tt>reason == exit_reason::normal</tt>.
+ * @brief Sends an exit message to @p whom with @p reason.
+ *
+ * This function is syntactic sugar for
+ * <tt>send(whom, atom("EXIT"), reason)</tt>.
+ * @pre <tt>reason != exit_reason::normal</tt>
*/
-inline void quit_actor(const actor_ptr& whom, std::uint32_t reason) {
+inline void send_exit(const actor_ptr& whom, std::uint32_t reason) {
CPPA_REQUIRE(reason != exit_reason::normal);
- send(whom.get(), atom("EXIT"), reason);
+ send(whom, atom("EXIT"), reason);
}
/**
@@ -22,7 +22,7 @@ behavior ping_behavior(size_t num_pings) {
CPPA_LOGF_ERROR_IF(!self->last_sender(), "last_sender() == nullptr");
//cout << to_string(self->last_dequeued()) << endl;
if (++s_pongs >= num_pings) {
- quit_actor(self->last_sender(), exit_reason::user_defined);
+ send_exit(self->last_sender(), exit_reason::user_defined);
self->quit();
}
else reply(atom("ping"), value);
@@ -202,7 +202,7 @@ string behavior_test(actor_ptr et) {
throw runtime_error(testee_name + " does not reply");
}
);
- quit_actor(et, exit_reason::user_defined);
+ send_exit(et, exit_reason::user_defined);
await_all_others_done();
return result;
}
@@ -309,7 +309,7 @@ int main() {
on("hello mirror") >> CPPA_CHECKPOINT_CB(),
others() >> CPPA_UNEXPECTED_MSG_CB()
);
- quit_actor(mirror, exit_reason::user_defined);
+ send_exit(mirror, exit_reason::user_defined);
receive (
on(atom("DOWN"), exit_reason::user_defined) >> CPPA_CHECKPOINT_CB(),
others() >> CPPA_UNEXPECTED_MSG_CB()
@@ -325,7 +325,7 @@ int main() {
on("hello mirror") >> CPPA_CHECKPOINT_CB(),
others() >> CPPA_UNEXPECTED_MSG_CB()
);
- quit_actor(mirror, exit_reason::user_defined);
+ send_exit(mirror, exit_reason::user_defined);
receive (
on(atom("DOWN"), exit_reason::user_defined) >> CPPA_CHECKPOINT_CB(),
others() >> CPPA_UNEXPECTED_MSG_CB()
@@ -429,7 +429,7 @@ int main() {
CPPA_CHECK(values == expected);
}
// terminate st
- quit_actor(st, exit_reason::user_defined);
+ send_exit(st, exit_reason::user_defined);
await_all_others_done();
CPPA_CHECKPOINT();
@@ -625,8 +625,8 @@ int main() {
CPPA_CHECK_EQUAL(name, "bob");
}
);
- quit_actor(a1, exit_reason::user_defined);
- quit_actor(a2, exit_reason::user_defined);
+ send_exit(a1, exit_reason::user_defined);
+ send_exit(a2, exit_reason::user_defined);
await_all_others_done();
factory::event_based([](int* i) {
@@ -652,7 +652,7 @@ int main() {
}
become(others() >> CPPA_UNEXPECTED_MSG_CB());
});
- quit_actor(legion, exit_reason::user_defined);
+ send_exit(legion, exit_reason::user_defined);
await_all_others_done();
CPPA_CHECKPOINT();
self->trap_exit(true);
@@ -215,7 +215,7 @@ int main() {
.continue_with([&] { continuation_called = true; });
self->exec_behavior_stack();
CPPA_CHECK_EQUAL(continuation_called, true);
- quit_actor(mirror, exit_reason::user_defined);
+ send_exit(mirror, exit_reason::user_defined);
await_all_others_done();
CPPA_CHECKPOINT();
auto await_success_message = [&] {
@@ -271,7 +271,7 @@ int main() {
sync_send(c, atom("gogo")).then(CPPA_CHECKPOINT_CB())
.continue_with(CPPA_CHECKPOINT_CB());
self->exec_behavior_stack();
- quit_actor(c, exit_reason::user_defined);
+ send_exit(c, exit_reason::user_defined);
await_all_others_done();
CPPA_CHECKPOINT();

0 comments on commit 682b0ee

Please sign in to comment.