|
Ninja
|
SubprocessSet runs a ppoll/pselect() loop around a set of Subprocesses. More...
#include <subprocess.h>
Public Member Functions | |
| Subprocess * | Add (const std::string &command, bool use_console=false) |
| void | CheckConsoleProcessTerminated () |
| void | Clear () |
| bool | DoWork () |
| Subprocess * | NextFinished () |
| SubprocessSet () | |
| ~SubprocessSet () | |
Static Public Member Functions | |
| static void | HandlePendingInterruption () |
| static bool | IsInterrupted () |
| Whether ninja should quit. Set on SIGINT, SIGTERM or SIGHUP reception. More... | |
| static void | SetInterruptedFlag (int signum) |
| static void | SigChldHandler (int signo, siginfo_t *info, void *context) |
Public Attributes | |
| std::queue< Subprocess * > | finished_ |
| struct sigaction | old_chld_act_ |
| struct sigaction | old_hup_act_ |
| struct sigaction | old_int_act_ |
| sigset_t | old_mask_ |
| struct sigaction | old_term_act_ |
| std::vector< Subprocess * > | running_ |
Static Public Attributes | |
| static volatile sig_atomic_t | interrupted_ |
| Store the signal number that causes the interruption. More... | |
| static volatile sig_atomic_t | s_sigchld_received |
| Initialized to 0 before ppoll/pselect(). More... | |
SubprocessSet runs a ppoll/pselect() loop around a set of Subprocesses.
DoWork() waits for any state change in subprocesses; finished_ is a queue of subprocesses as they finish.
Definition at line 101 of file subprocess.h.
| SubprocessSet::SubprocessSet | ( | ) |
Definition at line 252 of file subprocess-posix.cc.
References Fatal(), old_chld_act_, old_hup_act_, old_int_act_, old_mask_, old_term_act_, SetInterruptedFlag(), and SigChldHandler().
| SubprocessSet::~SubprocessSet | ( | ) |
Definition at line 296 of file subprocess-posix.cc.
References Clear(), Fatal(), old_chld_act_, old_hup_act_, old_int_act_, old_mask_, and old_term_act_.
| Subprocess * SubprocessSet::Add | ( | const std::string & | command, |
| bool | use_console = false |
||
| ) |
Definition at line 311 of file subprocess-posix.cc.
References running_, and Subprocess::Start().
Referenced by RealCommandRunner::StartCommand().
| void SubprocessSet::CheckConsoleProcessTerminated | ( | ) |
Definition at line 283 of file subprocess-posix.cc.
References finished_, running_, and s_sigchld_received.
Referenced by DoWork().
| void SubprocessSet::Clear | ( | ) |
Definition at line 451 of file subprocess-posix.cc.
References interrupted_, and running_.
Referenced by RealCommandRunner::Abort(), and ~SubprocessSet().
| bool SubprocessSet::DoWork | ( | ) |
Definition at line 391 of file subprocess-posix.cc.
References CheckConsoleProcessTerminated(), finished_, HandlePendingInterruption(), interrupted_, IsInterrupted(), old_mask_, running_, and s_sigchld_received.
Referenced by RealCommandRunner::WaitForCommand().
|
static |
Definition at line 237 of file subprocess-posix.cc.
References interrupted_.
Referenced by DoWork().
|
inlinestatic |
Whether ninja should quit. Set on SIGINT, SIGTERM or SIGHUP reception.
Definition at line 124 of file subprocess.h.
References interrupted_.
Referenced by DoWork().
| Subprocess * SubprocessSet::NextFinished | ( | ) |
Definition at line 443 of file subprocess-posix.cc.
References finished_.
Referenced by RealCommandRunner::WaitForCommand().
|
static |
Definition at line 229 of file subprocess-posix.cc.
References interrupted_.
Referenced by SubprocessSet().
|
static |
Definition at line 233 of file subprocess-posix.cc.
References s_sigchld_received.
Referenced by SubprocessSet().
| std::queue<Subprocess*> SubprocessSet::finished_ |
Definition at line 111 of file subprocess.h.
Referenced by RealCommandRunner::CanRunMore(), CheckConsoleProcessTerminated(), DoWork(), and NextFinished().
|
static |
Store the signal number that causes the interruption.
0 if not interruption.
Definition at line 122 of file subprocess.h.
Referenced by Clear(), DoWork(), HandlePendingInterruption(), IsInterrupted(), and SetInterruptedFlag().
| struct sigaction SubprocessSet::old_chld_act_ |
Definition at line 130 of file subprocess.h.
Referenced by SubprocessSet(), and ~SubprocessSet().
| struct sigaction SubprocessSet::old_hup_act_ |
Definition at line 130 of file subprocess.h.
Referenced by SubprocessSet(), and ~SubprocessSet().
| struct sigaction SubprocessSet::old_int_act_ |
Definition at line 130 of file subprocess.h.
Referenced by SubprocessSet(), and ~SubprocessSet().
| sigset_t SubprocessSet::old_mask_ |
Definition at line 136 of file subprocess.h.
Referenced by DoWork(), Subprocess::Start(), SubprocessSet(), and ~SubprocessSet().
| struct sigaction SubprocessSet::old_term_act_ |
Definition at line 130 of file subprocess.h.
Referenced by SubprocessSet(), and ~SubprocessSet().
| std::vector<Subprocess*> SubprocessSet::running_ |
Definition at line 110 of file subprocess.h.
Referenced by Add(), RealCommandRunner::CanRunMore(), CheckConsoleProcessTerminated(), Clear(), and DoWork().
|
static |
Initialized to 0 before ppoll/pselect().
Filled to 1 by SIGCHLD handler when a child process terminates.
Definition at line 129 of file subprocess.h.
Referenced by CheckConsoleProcessTerminated(), DoWork(), and SigChldHandler().