Ninja
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
SubprocessSet Struct Reference

SubprocessSet runs a ppoll/pselect() loop around a set of Subprocesses. More...

#include <subprocess.h>

Public Member Functions

SubprocessAdd (const std::string &command, bool use_console=false)
 
void Clear ()
 
bool DoWork ()
 
SubprocessNextFinished ()
 
 SubprocessSet ()
 
 ~SubprocessSet ()
 

Static Public Member Functions

static void HandlePendingInterruption ()
 
static bool IsInterrupted ()
 
static void SetInterruptedFlag (int signum)
 

Public Attributes

std::queue< Subprocess * > finished_
 
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 int interrupted_
 Store the signal number that causes the interruption. More...
 

Detailed Description

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 82 of file subprocess.h.

Constructor & Destructor Documentation

◆ SubprocessSet()

SubprocessSet::SubprocessSet ( )

◆ ~SubprocessSet()

SubprocessSet::~SubprocessSet ( )

Definition at line 228 of file subprocess-posix.cc.

References Clear(), Fatal(), old_hup_act_, old_int_act_, old_mask_, and old_term_act_.

Member Function Documentation

◆ Add()

Subprocess * SubprocessSet::Add ( const std::string &  command,
bool  use_console = false 
)

Definition at line 241 of file subprocess-posix.cc.

References running_, and Subprocess::Start().

Referenced by RealCommandRunner::StartCommand().

◆ Clear()

void SubprocessSet::Clear ( )

Definition at line 357 of file subprocess-posix.cc.

References interrupted_, and running_.

Referenced by RealCommandRunner::Abort(), and ~SubprocessSet().

◆ DoWork()

bool SubprocessSet::DoWork ( )

◆ HandlePendingInterruption()

void SubprocessSet::HandlePendingInterruption ( )
static

Definition at line 193 of file subprocess-posix.cc.

References interrupted_.

Referenced by DoWork().

◆ IsInterrupted()

static bool SubprocessSet::IsInterrupted ( )
inlinestatic

Definition at line 104 of file subprocess.h.

References interrupted_.

Referenced by DoWork().

◆ NextFinished()

Subprocess * SubprocessSet::NextFinished ( )

Definition at line 349 of file subprocess-posix.cc.

References finished_.

Referenced by RealCommandRunner::WaitForCommand().

◆ SetInterruptedFlag()

void SubprocessSet::SetInterruptedFlag ( int  signum)
static

Definition at line 189 of file subprocess-posix.cc.

References interrupted_.

Referenced by SubprocessSet().

Member Data Documentation

◆ finished_

std::queue<Subprocess*> SubprocessSet::finished_

Definition at line 92 of file subprocess.h.

Referenced by RealCommandRunner::CanRunMore(), DoWork(), and NextFinished().

◆ interrupted_

int SubprocessSet::interrupted_
static

Store the signal number that causes the interruption.

0 if not interruption.

Definition at line 102 of file subprocess.h.

Referenced by Clear(), DoWork(), HandlePendingInterruption(), IsInterrupted(), and SetInterruptedFlag().

◆ old_hup_act_

struct sigaction SubprocessSet::old_hup_act_

Definition at line 108 of file subprocess.h.

Referenced by SubprocessSet(), and ~SubprocessSet().

◆ old_int_act_

struct sigaction SubprocessSet::old_int_act_

Definition at line 106 of file subprocess.h.

Referenced by SubprocessSet(), and ~SubprocessSet().

◆ old_mask_

sigset_t SubprocessSet::old_mask_

Definition at line 109 of file subprocess.h.

Referenced by DoWork(), SubprocessSet(), and ~SubprocessSet().

◆ old_term_act_

struct sigaction SubprocessSet::old_term_act_

Definition at line 107 of file subprocess.h.

Referenced by SubprocessSet(), and ~SubprocessSet().

◆ running_

std::vector<Subprocess*> SubprocessSet::running_

Definition at line 91 of file subprocess.h.

Referenced by Add(), RealCommandRunner::CanRunMore(), Clear(), and DoWork().


The documentation for this struct was generated from the following files: