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". More...
|
|
bool | isRunning () |
|
pid_t | getPID () const |
| Get PID of running "thread".
|
|
int | wait () |
| Wait for this "thread", and return the process' exit status. More...
|
|
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 |
( |
| ) |
|
Check if "thread" is running.
◆ run()
virtual int UI::Util::ProcessThread::run |
( |
| ) |
|
|
protectedpure virtual |
Virtual function of thread's task.
◆ 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.
◆ pid_
pid_t UI::Util::ProcessThread::pid_ |
|
protected |
Process id of thread: Must be set properly by overloaded start method.
◆ status_
int UI::Util::ProcessThread::status_ |
|
protected |
Status of thread: Must be set properly by overloaded start method.
The documentation for this class was generated from the following files: