diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-10-23 12:21:08 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-10-23 12:27:19 +0200 |
commit | 6d700e3601a3469981995fd364d1a1ff7f158e5e (patch) | |
tree | c566f2ef764d48b369f18b0ac42ca723f1de57d9 /libbuild2/module.cxx | |
parent | 33e665c41928824a0410f0328a1fe9873381faaf (diff) |
Un-tune scheduler when building build system modules
Diffstat (limited to 'libbuild2/module.cxx')
-rw-r--r-- | libbuild2/module.cxx | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/libbuild2/module.cxx b/libbuild2/module.cxx index 45cbd30..b73ddb3 100644 --- a/libbuild2/module.cxx +++ b/libbuild2/module.cxx @@ -243,11 +243,25 @@ namespace build2 diag_frame::stack_guard diag_cutoff (nullptr); auto df = make_diag_frame ( - [&loc, &mod](const diag_record& dr) + [&loc, &mod] (const diag_record& dr) { dr << info (loc) << "while loading build system module " << mod; }); + // Un-tune the scheduler. + // + // Note that we can only do this if we are running serially because + // otherwise we cannot guarantee the scheduler is idle (we could + // have waiting threads from the outer context). This is fine for + // now since the only two tuning level we use are serial and full + // concurrency (turns out currently we don't really need this: we + // will always be called during load or match phases and we always + // do parallel match; but let's keep it in case things change). + // + auto sched_tune (ctx.sched.serial () + ? scheduler::tune_guard (ctx.sched, 0) + : scheduler::tune_guard ()); + // Note that for now we suppress progress since it would clash with // the progress of what we are already doing (maybe in the future we // can do save/restore but then we would need some sort of |