From 330db1f15d95537e288b4c371a26e43b5a9b2196 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 12 May 2021 10:42:42 +0200 Subject: Deal with helper thread starvation during phase switching The implemented solution entails shadowing old phase queues so that helpers don't pick up old phase tasks and boosting the max_threads count so that we can create more helpers if all the existing ones are stuck in the old phase. --- libbuild2/adhoc-rule-cxx.cxx | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libbuild2/adhoc-rule-cxx.cxx') diff --git a/libbuild2/adhoc-rule-cxx.cxx b/libbuild2/adhoc-rule-cxx.cxx index ece687f..1066f0a 100644 --- a/libbuild2/adhoc-rule-cxx.cxx +++ b/libbuild2/adhoc-rule-cxx.cxx @@ -297,6 +297,10 @@ namespace build2 auto_thread_env penv (nullptr); context& ctx (*t.ctx.module_context); + // Enter a scheduler sub-phase. + // + scheduler::phase_guard pg (ctx.sched); + // Mark the queue so that we don't work any tasks that may already be // there. // -- cgit v1.1