diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2021-05-11 17:17:34 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2021-05-11 17:17:34 +0300 |
commit | bfef269358716de18c7beab08b22c15e3654c5f7 (patch) | |
tree | 11db739a3778ae0c1c66875f93dfbd219c47a72a | |
parent | aaac3b0b28c271a258902e16389a0e71c8fb074d (diff) |
Fix an earlier fix to algorithm::traverse, where the earlier fix was obviously broken.
-rw-r--r-- | include/llfio/v2.0/detail/impl/traverse.ipp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/llfio/v2.0/detail/impl/traverse.ipp b/include/llfio/v2.0/detail/impl/traverse.ipp index 190bcd08..7c4be156 100644 --- a/include/llfio/v2.0/detail/impl/traverse.ipp +++ b/include/llfio/v2.0/detail/impl/traverse.ipp @@ -415,11 +415,11 @@ namespace algorithm state.threads_sleeping++; maincond.notify_all(); cond.wait(g); + state.threads_sleeping--; if(done) { break; } - state.threads_sleeping--; } else { @@ -441,6 +441,7 @@ namespace algorithm break; } } + state.threads_sleeping++; state.threads_running--; maincond.notify_all(); }, @@ -449,7 +450,7 @@ namespace algorithm } { std::unique_lock<std::mutex> g(state.lock); - while(state.threads_sleeping < threads) + while(state.threads_sleeping < threads && !done) { maincond.wait(g); } |