From bfef269358716de18c7beab08b22c15e3654c5f7 Mon Sep 17 00:00:00 2001 From: "Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com)" Date: Tue, 11 May 2021 15:17:34 +0100 Subject: Fix an earlier fix to algorithm::traverse, where the earlier fix was obviously broken. --- include/llfio/v2.0/detail/impl/traverse.ipp | 5 +++-- 1 file 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 g(state.lock); - while(state.threads_sleeping < threads) + while(state.threads_sleeping < threads && !done) { maincond.wait(g); } -- cgit v1.2.3