Commit 682b0ee1 authored by Dominik Charousset's avatar Dominik Charousset

renamed `quit_actor` to `send_exit`

parent f04d525e
...@@ -856,12 +856,15 @@ actor_ptr remote_actor(network::io_stream_ptr_pair connection); ...@@ -856,12 +856,15 @@ actor_ptr remote_actor(network::io_stream_ptr_pair connection);
void shutdown(); // note: implemented in singleton_manager.cpp void shutdown(); // note: implemented in singleton_manager.cpp
/** /**
* @brief Causes @p whom to quit with @p reason. * @brief Sends an exit message to @p whom with @p reason.
* @note Does nothing if <tt>reason == exit_reason::normal</tt>. *
* 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); 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) { ...@@ -22,7 +22,7 @@ behavior ping_behavior(size_t num_pings) {
CPPA_LOGF_ERROR_IF(!self->last_sender(), "last_sender() == nullptr"); CPPA_LOGF_ERROR_IF(!self->last_sender(), "last_sender() == nullptr");
//cout << to_string(self->last_dequeued()) << endl; //cout << to_string(self->last_dequeued()) << endl;
if (++s_pongs >= num_pings) { 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(); self->quit();
} }
else reply(atom("ping"), value); else reply(atom("ping"), value);
......
...@@ -202,7 +202,7 @@ string behavior_test(actor_ptr et) { ...@@ -202,7 +202,7 @@ string behavior_test(actor_ptr et) {
throw runtime_error(testee_name + " does not reply"); 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(); await_all_others_done();
return result; return result;
} }
...@@ -309,7 +309,7 @@ int main() { ...@@ -309,7 +309,7 @@ int main() {
on("hello mirror") >> CPPA_CHECKPOINT_CB(), on("hello mirror") >> CPPA_CHECKPOINT_CB(),
others() >> CPPA_UNEXPECTED_MSG_CB() others() >> CPPA_UNEXPECTED_MSG_CB()
); );
quit_actor(mirror, exit_reason::user_defined); send_exit(mirror, exit_reason::user_defined);
receive ( receive (
on(atom("DOWN"), exit_reason::user_defined) >> CPPA_CHECKPOINT_CB(), on(atom("DOWN"), exit_reason::user_defined) >> CPPA_CHECKPOINT_CB(),
others() >> CPPA_UNEXPECTED_MSG_CB() others() >> CPPA_UNEXPECTED_MSG_CB()
...@@ -325,7 +325,7 @@ int main() { ...@@ -325,7 +325,7 @@ int main() {
on("hello mirror") >> CPPA_CHECKPOINT_CB(), on("hello mirror") >> CPPA_CHECKPOINT_CB(),
others() >> CPPA_UNEXPECTED_MSG_CB() others() >> CPPA_UNEXPECTED_MSG_CB()
); );
quit_actor(mirror, exit_reason::user_defined); send_exit(mirror, exit_reason::user_defined);
receive ( receive (
on(atom("DOWN"), exit_reason::user_defined) >> CPPA_CHECKPOINT_CB(), on(atom("DOWN"), exit_reason::user_defined) >> CPPA_CHECKPOINT_CB(),
others() >> CPPA_UNEXPECTED_MSG_CB() others() >> CPPA_UNEXPECTED_MSG_CB()
...@@ -429,7 +429,7 @@ int main() { ...@@ -429,7 +429,7 @@ int main() {
CPPA_CHECK(values == expected); CPPA_CHECK(values == expected);
} }
// terminate st // terminate st
quit_actor(st, exit_reason::user_defined); send_exit(st, exit_reason::user_defined);
await_all_others_done(); await_all_others_done();
CPPA_CHECKPOINT(); CPPA_CHECKPOINT();
...@@ -625,8 +625,8 @@ int main() { ...@@ -625,8 +625,8 @@ int main() {
CPPA_CHECK_EQUAL(name, "bob"); CPPA_CHECK_EQUAL(name, "bob");
} }
); );
quit_actor(a1, exit_reason::user_defined); send_exit(a1, exit_reason::user_defined);
quit_actor(a2, exit_reason::user_defined); send_exit(a2, exit_reason::user_defined);
await_all_others_done(); await_all_others_done();
factory::event_based([](int* i) { factory::event_based([](int* i) {
...@@ -652,7 +652,7 @@ int main() { ...@@ -652,7 +652,7 @@ int main() {
} }
become(others() >> CPPA_UNEXPECTED_MSG_CB()); become(others() >> CPPA_UNEXPECTED_MSG_CB());
}); });
quit_actor(legion, exit_reason::user_defined); send_exit(legion, exit_reason::user_defined);
await_all_others_done(); await_all_others_done();
CPPA_CHECKPOINT(); CPPA_CHECKPOINT();
self->trap_exit(true); self->trap_exit(true);
......
...@@ -215,7 +215,7 @@ int main() { ...@@ -215,7 +215,7 @@ int main() {
.continue_with([&] { continuation_called = true; }); .continue_with([&] { continuation_called = true; });
self->exec_behavior_stack(); self->exec_behavior_stack();
CPPA_CHECK_EQUAL(continuation_called, true); CPPA_CHECK_EQUAL(continuation_called, true);
quit_actor(mirror, exit_reason::user_defined); send_exit(mirror, exit_reason::user_defined);
await_all_others_done(); await_all_others_done();
CPPA_CHECKPOINT(); CPPA_CHECKPOINT();
auto await_success_message = [&] { auto await_success_message = [&] {
...@@ -271,7 +271,7 @@ int main() { ...@@ -271,7 +271,7 @@ int main() {
sync_send(c, atom("gogo")).then(CPPA_CHECKPOINT_CB()) sync_send(c, atom("gogo")).then(CPPA_CHECKPOINT_CB())
.continue_with(CPPA_CHECKPOINT_CB()); .continue_with(CPPA_CHECKPOINT_CB());
self->exec_behavior_stack(); self->exec_behavior_stack();
quit_actor(c, exit_reason::user_defined); send_exit(c, exit_reason::user_defined);
await_all_others_done(); await_all_others_done();
CPPA_CHECKPOINT(); CPPA_CHECKPOINT();
......
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