ACE 8.0.1
|
A portable encapsulation for creating and managing new processes. More...
#include <Process.h>
Public Member Functions | |
ACE_Process () | |
Default construction. Use ACE_Process::spawn() to start a process. | |
virtual | ~ACE_Process () |
Destructor. | |
virtual int | prepare (ACE_Process_Options &options) |
virtual pid_t | spawn (ACE_Process_Options &options) |
virtual void | parent (pid_t child) |
virtual void | child (pid_t parent) |
virtual void | unmanage () |
pid_t | wait (ACE_exitcode *status=0, int wait_options=0) |
pid_t | wait (const ACE_Time_Value &tv, ACE_exitcode *status=0) |
int | kill (int signum=SIGINT) |
int | terminate () |
pid_t | getpid () const |
Return the process id of the new child process. | |
ACE_HANDLE | gethandle () const |
Return the handle of the process, if it has one. | |
int | running () const |
Return 1 if running; 0 otherwise. | |
ACE_exitcode | exit_code () const |
int | return_value () const |
void | close_dup_handles () |
void | close_passed_handles () |
PROCESS_INFORMATION | process_info () |
Protected Member Functions | |
void | exit_code (ACE_exitcode code) |
Protected Attributes | |
PROCESS_INFORMATION | process_info_ |
ACE_exitcode | exit_code_ |
ACE_Handle_Set | handles_passed_ |
Set of handles that were passed to the child process. | |
ACE_Handle_Set | dup_handles_ |
Handle duplicates made for the child process. | |
Private Member Functions | |
ACE_Process (const ACE_Process &)=delete | |
void | operator= (const ACE_Process &)=delete |
ACE_Process (ACE_Process &&)=delete | |
void | operator= (ACE_Process &&)=delete |
wchar_t * | convert_env_buffer (const char *env) const |
Friends | |
class | ACE_Process_Manager |
A portable encapsulation for creating and managing new processes.
ACE_Process provides a convenient way to:
ACE_Process::ACE_Process | ( | ) |
Default construction. Use ACE_Process::spawn() to start a process.
|
virtual |
Destructor.
|
privatedelete |
|
privatedelete |
Called back from spawn() in the child's context just after forking. The default does nothing.
void ACE_Process::close_dup_handles | ( | ) |
Close all the handles in the set obtained from the ACE_Process_Options::dup_handles object used to spawn the process.
void ACE_Process::close_passed_handles | ( | ) |
Close all the passed handles in the set obtained from the ACE_Process_Options object used to spawn the process.
|
inline |
Return the process's exit code. This method returns the raw exit status returned from system APIs (such as wait()
or waitpid()
). This value is system dependent.
|
inlineprotected |
Set this process's exit code. ACE_Process_Manager uses this method to set the exit code after successfully waiting for this process to exit.
|
inline |
Return the handle of the process, if it has one.
|
inline |
Return the process id of the new child process.
Send the process a signal. This only has an effect on operating systems that support signals, such as UNIX/POSIX.
|
privatedelete |
|
privatedelete |
Called back from spawn() in the parent's context just after forking, if the fork succeeds. The default simply returns.
|
virtual |
Called back from spawn() just before spawning the child. If this returns non-zero, the spawn is aborted (and returns ACE_INVALID_PID). The default returns zero.
|
inline |
|
inline |
Return the process's return value. This method returns the actual return value that a child process returns or exits with.
int ACE_Process::running | ( | ) | const |
Return 1 if running; 0 otherwise.
|
virtual |
Launch a new process as described by options.
-1 | on failure; check errno for error code. |
1 | on success if the option avoid_zombies is set. |
other | the process id of the newly spawned child. |
avoid_zombies
option.
|
inline |
Terminate the process abruptly using ACE::terminate_process(). This call doesn't give the process a chance to cleanup, so use it with caution.
|
virtual |
Called by a ACE_Process_Manager that is removing this object from its table of managed processes. Default is to do nothing.
Reimplemented in ACE_Managed_Process.
|
inline |
Wait for a previously spawned process to exit.
WNOHANG
then return 0 and don't block if the child process hasn't exited yet.-1 | the wait operation failed; consult errno for details. |
other | the child process id is returned on success. |
pid_t ACE_Process::wait | ( | const ACE_Time_Value & | tv, |
ACE_exitcode * | status = 0 ) |
Timed wait for a previously spawned process to exit.
0 | the specified time period elapsed before the process exited. |
-1 | the wait operation failed; consult errno for details. |
other | the child process id is returned on success. |
ualarm()
, i.e., it overwrites any existing alarm. In addition, it steals all SIGCHLD
signals during the timeout period, which will break another ACE_Process_Manager in the same process that's expecting SIGCHLD
to kick off process reaping.
|
friend |
|
protected |
Handle duplicates made for the child process.
|
protected |
|
protected |
Set of handles that were passed to the child process.
|
protected |