Commit 63407ab1 authored by Dominik Charousset's avatar Dominik Charousset

refactored down messages

parent d62a3871
...@@ -367,7 +367,7 @@ void shutdown_mode(Iterator first, Iterator last) { ...@@ -367,7 +367,7 @@ void shutdown_mode(Iterator first, Iterator last) {
self->monitor(x); self->monitor(x);
send(x, atom("shutdown")); send(x, atom("shutdown"));
receive ( receive (
on(atom("DOWN"), x, val<std::uint32_t>) >> []() { on(atom("DOWN"), val<std::uint32_t>) >> []() {
// ok, done // ok, done
}, },
after(std::chrono::seconds(10)) >> [&]() { after(std::chrono::seconds(10)) >> [&]() {
......
...@@ -49,7 +49,10 @@ class down_observer : public attachable { ...@@ -49,7 +49,10 @@ class down_observer : public attachable {
} }
void actor_exited(std::uint32_t reason) { void actor_exited(std::uint32_t reason) {
send(m_observer, atom("DOWN"), m_observed, reason); if (m_observer) {
m_observer->enqueue(m_observed.get(),
make_any_tuple(atom("DOWN"), reason));
}
} }
bool matches(const attachable::token& match_token) { bool matches(const attachable::token& match_token) {
......
...@@ -542,8 +542,8 @@ size_t test__spawn() { ...@@ -542,8 +542,8 @@ size_t test__spawn() {
CPPA_CHECK(self->last_sender() == pong_actor); CPPA_CHECK(self->last_sender() == pong_actor);
flags |= 0x01; flags |= 0x01;
}, },
on<atom("DOWN"), actor_ptr, std::uint32_t>() >> [&](const actor_ptr& who, on<atom("DOWN"), std::uint32_t>() >> [&](std::uint32_t reason) {
std::uint32_t reason) { auto who = self->last_sender();
if (who == pong_actor) { if (who == pong_actor) {
flags |= 0x02; flags |= 0x02;
CPPA_CHECK_EQUAL(reason, exit_reason::user_defined); CPPA_CHECK_EQUAL(reason, exit_reason::user_defined);
......
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