Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
signals-impl.hh File Reference
#include "nix/util/types.hh"
#include "nix/util/error.hh"
#include "nix/util/logging.hh"
#include "nix/util/ansicolor.hh"
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <unistd.h>
#include <signal.h>
#include <boost/lexical_cast.hpp>
#include <atomic>
#include <functional>
#include <map>
#include <sstream>
#include <optional>

Go to the source code of this file.

Classes

struct  nix::ReceiveInterrupts

Functions

void nix::unix::_interrupted ()
void nix::unix::startSignalHandlerThread ()
void nix::unix::saveSignalMask ()
void nix::unix::restoreSignals ()
void nix::unix::triggerInterrupt ()
void nix::checkInterrupt ()

Variables

std::atomic< bool > nix::unix::_isInterrupted = false
std::function< bool()> nix::unix::interruptCheck

Detailed Description

Implementation of some inline definitions for Unix signals, and also some extra Unix-only interfaces.

(The only reason everything about signals isn't Unix-only is some no-op definitions are provided on Windows to avoid excess CPP in downstream code.)

Function Documentation

◆ checkInterrupt()

void nix::checkInterrupt ( )
inline
Note
Does nothing on Windows

Throw Interrupted exception if the process has been interrupted.

Call this in long-running loops and between slow operations to terminate them as needed.

◆ restoreSignals()

void nix::unix::restoreSignals ( )

To use in a process that already called startSignalHandlerThread() or saveSignalMask() first.

◆ saveSignalMask()

void nix::unix::saveSignalMask ( )

Saves the signal mask, which is the signal mask that nix will restore before creating child processes.

◆ startSignalHandlerThread()

void nix::unix::startSignalHandlerThread ( )

Start a thread that handles various signals. Also block those signals on the current thread (and thus any threads created by it). Saves the signal mask before changing the mask to block those signals. See saveSignalMask().