mirror of
https://github.com/boostorg/build.git
synced 2026-07-21 13:13:39 +00:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user