Make some more threads receive interrupts

Shouldn't hurt to do this. In particular, this should speed up
shutting down the PathSubstitutionGoal thread if it's copying from a
remote store.
This commit is contained in:
Eelco Dolstra 2024-01-03 19:30:02 +01:00
parent 24e70489e5
commit 295a2ff8bd
2 changed files with 5 additions and 0 deletions

View file

@ -2,6 +2,7 @@
#include "substitution-goal.hh" #include "substitution-goal.hh"
#include "nar-info.hh" #include "nar-info.hh"
#include "finally.hh" #include "finally.hh"
#include "signals.hh"
namespace nix { namespace nix {
@ -217,6 +218,8 @@ void PathSubstitutionGoal::tryToRun()
thr = std::thread([this]() { thr = std::thread([this]() {
try { try {
ReceiveInterrupts receiveInterrupts;
/* Wake up the worker loop when we're done. */ /* Wake up the worker loop when we're done. */
Finally updateStats([this]() { outPipe.writeSide.close(); }); Finally updateStats([this]() { outPipe.writeSide.close(); });

View file

@ -79,6 +79,8 @@ void ThreadPool::process()
void ThreadPool::doWork(bool mainThread) void ThreadPool::doWork(bool mainThread)
{ {
ReceiveInterrupts receiveInterrupts;
if (!mainThread) if (!mainThread)
interruptCheck = [&]() { return (bool) quit; }; interruptCheck = [&]() { return (bool) quit; };