Lolly 1.4.27
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
spawn_system Class Reference

#include <spawn.hpp>

Collaboration diagram for spawn_system:
Collaboration graph
[legend]

Public Member Functions

 spawn_system (array< Channel > &ch, char *name, const char *const *args)
 
int getpid ()
 
int wait ()
 
bool isRunning ()
 

Private Attributes

intptr_t pid
 
array< Channel > & channel
 

Detailed Description

Definition at line 53 of file spawn.hpp.

Constructor & Destructor Documentation

◆ spawn_system()

spawn_system::spawn_system ( array< Channel > & ch,
char * name,
const char *const * args )

Definition at line 122 of file spawn.cpp.

124 : channel (ch) {
125 for (int i= 0; i < N (channel); ++i)
126 channel[i].redirect ();
127 pid= _spawnvp (_P_NOWAIT, name, args);
128 for (int i= 0; i < N (channel); ++i)
129 channel[i].closeUnused ();
130}
int N(array< T > a)
Get the length of the array.
Definition array.hpp:170
The list class represents a linked list.
Definition list.hpp:48
intptr_t pid
Definition spawn.hpp:61
array< Channel > & channel
Definition spawn.hpp:62

Member Function Documentation

◆ getpid()

int spawn_system::getpid ( )
inline

Definition at line 56 of file spawn.hpp.

56{ return (pid); }

◆ wait()

int spawn_system::wait ( )

Definition at line 133 of file spawn.cpp.

133 {
134 int ret;
135 if (pid > 0) ret= _cwait (&ret, pid, 0) == -1 ? errno : ret;
136 else ret= EINVAL;
137 for (int i= 0; i < N (channel); ++i)
138 channel[i].wait ();
139 return (ret);
140}
int wait()
Definition spawn.cpp:133

◆ isRunning()

bool spawn_system::isRunning ( )
inline

Definition at line 58 of file spawn.hpp.

58{ return (pid ? true : false); }

Member Data Documentation

◆ pid

intptr_t spawn_system::pid
private

Definition at line 61 of file spawn.hpp.

◆ channel

array<Channel>& spawn_system::channel
private

Definition at line 62 of file spawn.hpp.


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