Skip to content

Commit

Permalink
Make some more threads receive interrupts
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
edolstra committed Jan 3, 2024
1 parent 24e7048 commit 295a2ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libstore/build/substitution-goal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "substitution-goal.hh"
#include "nar-info.hh"
#include "finally.hh"
#include "signals.hh"

namespace nix {

Expand Down Expand Up @@ -217,6 +218,8 @@ void PathSubstitutionGoal::tryToRun()

thr = std::thread([this]() {
try {
ReceiveInterrupts receiveInterrupts;

/* Wake up the worker loop when we're done. */
Finally updateStats([this]() { outPipe.writeSide.close(); });

Expand Down
2 changes: 2 additions & 0 deletions src/libutil/thread-pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ void ThreadPool::process()

void ThreadPool::doWork(bool mainThread)
{
ReceiveInterrupts receiveInterrupts;

if (!mainThread)
interruptCheck = [&]() { return (bool) quit; };

Expand Down

0 comments on commit 295a2ff

Please sign in to comment.