eq::base::Process Class Reference

#include <process.h>

List of all members.


Detailed Description

An abstraction to create a new execution process.

Definition at line 22 of file process.h.


Public Member Functions

 Process ()
 Constructs a new process.
virtual ~Process ()
 Destructs the process.
bool start ()
 Starts the process.
virtual bool init ()
 The init function for the child process.
virtual int run ()=0
 The entry function for the child process.
virtual void exit (int retVal=0)
 Exits the child process immediately.
void cancel ()
 Cancels (stops) the child process.
bool join (int *retVal=NULL)
 Waits for the exit of the child process.
bool isStopped () const
 Returns if the process is stopped.
bool isRunning () const
 Returns if the process is running.
bool isCurrent () const
 Returns if this process is the current (calling) process.

Static Public Member Functions

static void addListener (RunnableListener *listener)
 Add a new process state listener.

Constructor & Destructor Documentation

eq::base::Process::~Process (  )  [virtual]

Destructs the process.

Definition at line 31 of file process.cpp.


Member Function Documentation

bool eq::base::Process::start (  ) 

Starts the process.

All process listeners will be notified from within the process, after the process was initialized successfully.

Returns:
true if the process was launched, false otherwise.
See also:
init(), run()

Definition at line 61 of file process.cpp.

virtual bool eq::base::Process::init (  )  [inline, virtual]

The init function for the child process.

Todo:
: The parent process will not be unlocked before this function has been executed. If the process initialisation fails, that is, this method did return false, the process will be stopped and the start() method will return false.
Returns:
the success value of the process initialisation.

Definition at line 55 of file process.h.

virtual int eq::base::Process::run (  )  [pure virtual]

The entry function for the child process.

Returns:
the return value of the child process.

void eq::base::Process::exit ( int  retVal = 0  )  [virtual]

Exits the child process immediately.

This function does not return. It is only to be called from the child process. The process listeners will be notified.

Parameters:
retVal the return value of the process.

Definition at line 92 of file process.cpp.

References isCurrent().

Here is the call graph for this function:

void eq::base::Process::cancel (  ) 

Cancels (stops) the child process.

This function is not to be called from the child process.

Definition at line 103 of file process.cpp.

References isCurrent().

Here is the call graph for this function:

bool eq::base::Process::join ( int *  retVal = NULL  ) 

Waits for the exit of the child process.

The actual size of the return value may be as low as 8 bits.

Parameters:
retVal output value for the return value of the child, can be NULL.
Returns:
true if the process was joined, false otherwise.

Definition at line 114 of file process.cpp.

References isCurrent().

Here is the call graph for this function:

bool eq::base::Process::isStopped (  )  const [inline]

Returns if the process is stopped.

Note that the process may be neither running nor stopped if it is currently starting or stopping.

Returns:
true if the process is stopped, false if not.

Definition at line 102 of file process.h.

bool eq::base::Process::isRunning (  )  const [inline]

Returns if the process is running.

Note that the process may be neither running nor stopped if it is currently starting or stopping.

Returns:
true if the process is running, false if not.

Definition at line 113 of file process.h.

bool eq::base::Process::isCurrent (  )  const

Returns if this process is the current (calling) process.

Returns:
true if the current process has is the same process as this process, false if not.

Definition at line 152 of file process.cpp.

Referenced by cancel(), exit(), and join().

Here is the caller graph for this function:

void eq::base::Process::addListener ( RunnableListener *  listener  )  [static]

Add a new process state listener.

Todo:
listener implementation for processes.
Parameters:
listener the listener.

Definition at line 157 of file process.cpp.


The documentation for this class was generated from the following files:
Generated on Sat Dec 6 12:01:49 2008 for Equalizer 0.6 by  doxygen 1.5.5