aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbuild2/context.ixx8
1 files changed, 6 insertions, 2 deletions
diff --git a/libbuild2/context.ixx b/libbuild2/context.ixx
index 46fe4f7..73601d4 100644
--- a/libbuild2/context.ixx
+++ b/libbuild2/context.ixx
@@ -56,8 +56,12 @@ namespace build2
inline void wait_guard::
wait ()
{
- phase_unlock u (*ctx, phase);
- ctx->sched.wait (start_count, *task_count);
+ if (task_count->load (memory_order_acquire) > start_count)
+ {
+ phase_unlock u (*ctx, phase);
+ ctx->sched.wait (start_count, *task_count);
+ }
+
task_count = nullptr;
}
}