Commit 3d3abfa9 authored by Dominik Charousset's avatar Dominik Charousset

Correctly await blocking actors on shutdown

parent 9bc2ba7f
...@@ -674,6 +674,7 @@ void local_actor::launch(execution_unit* eu, bool lazy, bool hide) { ...@@ -674,6 +674,7 @@ void local_actor::launch(execution_unit* eu, bool lazy, bool hide) {
is_registered(! hide); is_registered(! hide);
if (is_detached()) { if (is_detached()) {
if (is_blocking()) { if (is_blocking()) {
home_system().inc_detached_threads();
std::thread([](strong_actor_ptr ptr) { std::thread([](strong_actor_ptr ptr) {
// actor lives in its own thread // actor lives in its own thread
auto this_ptr = ptr->get(); auto this_ptr = ptr->get();
...@@ -705,6 +706,7 @@ void local_actor::launch(execution_unit* eu, bool lazy, bool hide) { ...@@ -705,6 +706,7 @@ void local_actor::launch(execution_unit* eu, bool lazy, bool hide) {
// simply ignore exception // simply ignore exception
} }
self->cleanup(std::move(rsn), self->context()); self->cleanup(std::move(rsn), self->context());
ptr->home_system->dec_detached_threads();
}, ctrl()).detach(); }, ctrl()).detach();
return; return;
} }
......
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