diff --git a/src/vault/gear/work-force.hpp b/src/vault/gear/work-force.hpp index c234d3722..037d95cce 100644 --- a/src/vault/gear/work-force.hpp +++ b/src/vault/gear/work-force.hpp @@ -105,6 +105,7 @@ namespace gear { } ERROR_LOG_AND_IGNORE (threadpool, "defunct worker thread") ////////////////////////////////////////////////////////////////////////////OOO very important to have a reliable exit-hook here!!! + thread::detach(); } activity::Proc @@ -166,10 +167,17 @@ namespace gear { { for (auto& w : workers_) w.emergency.store(true, std::memory_order_relaxed); - for (auto& w : workers_) - if (w.joinable()) - w.join(); - workers_.clear(); + using namespace std::chrono_literals; ///////////////////////7///WIP + do + std::this_thread::sleep_for(10ms); + while (0 < size()); + } + + size_t + size() + { + workers_.remove_if([](auto& w){ return not w.joinable(); }); + return workers_.size(); } private: diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 8b4fa1aee..5c91e9d5a 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -79940,8 +79940,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + + @@ -79955,6 +79956,54 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + +
    +
  • + Exception wird gefangen im WorkForce-dtor +
  • +
  • + mit Debugger nicht reproduzierbar +
  • +
+

+ Vermutung: zwischen joinable() ≡ true und dem join()-Aufruf hat sich der Thread selber detached() +

+ +
+
+ + + + +

+ entweder ein Thread soll gereaped werden, oder ein Thread verschwindet einfach von der Bildfläche +

+ +
+
+
+ + + + + + + + + + + + + + + +