aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-06-25 08:05:00 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-06-25 08:05:00 +0200
commit3875999b2642013dfddd6cb1fa7b3ee7ac14f9d7 (patch)
tree3ffb23028daeadfdfaba166472524c254ecf62c3
parent454ae53155c64fd4edea2cd166ef77c638ac0f6e (diff)
Eliminate phase unlock for case where we are not going to wait
-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;
}
}