diff --git a/repos/base/src/lib/base/child.cc b/repos/base/src/lib/base/child.cc index adadfc05cc..e7a8ac9904 100644 --- a/repos/base/src/lib/base/child.cc +++ b/repos/base/src/lib/base/child.cc @@ -870,8 +870,13 @@ void Child::close_all_sessions() * warnings generated by threads that are losing their PD while still * running. */ - while (unsigned long id_value = any_cpu_session_id(_id_space).value) - (void)close(Parent::Client::Id{id_value}); + while (unsigned long id_value = any_cpu_session_id(_id_space).value) { + Close_result const close_result = close(Parent::Client::Id{id_value}); + + /* break infinte loop if CPU session is provided by a child */ + if (close_result != CLOSE_DONE) + break; + } _initial_thread.destruct();