Fix grep stalling randomly.

The one-way signaling that indicates a task group is done can fail and needs to be retried. As we can attempt the signal before anyone is waiting for it. In which case the waiting thread never notices the finish signal. To resolve it we loop until the signal works, indicating that a waiter was available to receive it.

fixes #601 (again)
This commit is contained in:
Rene Rivera
2026-07-13 00:17:42 -05:00
parent bf38101995
commit 10d899da54
+6 -1
View File
@@ -172,7 +172,12 @@ inline void group::implementation::call_queue(std::function<void()> f)
running -= 1;
signal_finished = pending.empty() && running == 0;
}
if (signal_finished) finished.signal();
if (signal_finished)
{
// Re-try the signal until it happens indicating that the waiting
// task is expecting it.
while (!finished.signal()) ;
}
};
{
scope_lock_t lock(mx);