Commit 3627cdb7 authored by Dominik Charousset's avatar Dominik Charousset

Fix exception handling in actor_registry::stop

parent ee447203
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "caf/spawn.hpp" #include "caf/spawn.hpp"
#include "caf/locks.hpp" #include "caf/locks.hpp"
#include "caf/exception.hpp"
#include "caf/actor_cast.hpp" #include "caf/actor_cast.hpp"
#include "caf/attachable.hpp" #include "caf/attachable.hpp"
#include "caf/exit_reason.hpp" #include "caf/exit_reason.hpp"
...@@ -166,14 +167,19 @@ void actor_registry::dispose() { ...@@ -166,14 +167,19 @@ void actor_registry::dispose() {
void actor_registry::stop() { void actor_registry::stop() {
scoped_actor self{true}; scoped_actor self{true};
for (auto& kvp : named_entries_) { try {
self->monitor(kvp.second); for (auto& kvp : named_entries_) {
self->send_exit(kvp.second, exit_reason::kill); self->monitor(kvp.second);
self->receive( self->send_exit(kvp.second, exit_reason::kill);
[](const down_msg&) { self->receive(
// nop [](const down_msg&) {
} // nop
); }
);
}
}
catch (actor_exited&) {
CAF_LOG_ERROR("actor_exited thrown in actor_registry::stop");
} }
named_entries_.clear(); named_entries_.clear();
} }
......
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