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/module.cxx | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libbuild2/module.cxx') diff --git a/libbuild2/module.cxx b/libbuild2/module.cxx index fc50aef..2ee29d6 100644 --- a/libbuild2/module.cxx +++ b/libbuild2/module.cxx @@ -418,6 +418,10 @@ namespace build2 auto_thread_env penv (nullptr); context& ctx (*bs.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 (we could be called in strange ways, for example, as part of // match via dir_search()). -- cgit v1.1