Simple encapsulation for any process based threading system.
More...
#include <Thread.hpp>
|
| enum | ReservedStatus { NotRunYet_ = 255
, Running_ = 254
, WaitpidErr_ = 253
, KilledByUncatchedSignal_ = 252
} |
| | Reserved exit status'. Do not use these as return codes in your run()-functions. More...
|
|
| virtual void | start ()=0 |
| | Start fork "thread".
|
| bool | isRunning () |
|
pid_t | getPID () const |
| | Get PID of running "thread".
|
| int | wait () |
| | Wait for this "thread", and return the process' exit status.
|
|
int | getStatus () const |
| | Get status of last run.
|
Simple encapsulation for any process based threading system.
You need to overload "start" and "run".
- Examples
- Threads.cpp.
◆ ReservedStatus
Reserved exit status'. Do not use these as return codes in your run()-functions.
Program exit status' are always between (including) 0..255; to be able to use the exit status directly in programs (e.g. for std::exit()), we reserve some values here (rather than using out-of-range values).
◆ isRunning()
| bool UI::Util::ProcessThread::isRunning |
( |
| ) |
|
◆ run()
| virtual int UI::Util::ProcessThread::run |
( |
| ) |
|
|
protectedpure virtual |
◆ start()
| virtual void UI::Util::ProcessThread::start |
( |
| ) |
|
|
pure virtual |
◆ wait()
| int UI::Util::ProcessThread::wait |
( |
| ) |
|
Wait for this "thread", and return the process' exit status.
You must use this method to avoid zombies, or ignore all SIGCHLDs in the parent.
- Examples
- Threads.cpp.
References status_, and wait().
Referenced by run(), and wait().
◆ pid_
| pid_t UI::Util::ProcessThread::pid_ |
|
protected |
◆ status_
| int UI::Util::ProcessThread::status_ |
|
protected |
The documentation for this class was generated from the following files: