Encapsulate generic threading methods. More...
#include <SGThread.hxx>
Public Types | |
enum | cancel_t |
SGThread cancelation modes. | |
Public Member Functions | |
SGThread () | |
Create a new thread object. | |
int | start (unsigned cpu=0) |
Start the underlying thread of execution. | |
void | cancel () |
Sends a cancellation request to the underlying thread. | |
void | join () |
Suspends the exection of the calling thread until this thread terminates. | |
Protected Member Functions | |
virtual | ~SGThread () |
Destroy a thread object. | |
void | set_cancel (cancel_t mode) |
Set the threads cancellation mode. | |
virtual void | run ()=0 |
All threads execute by deriving the run() method of SGThread. |
Encapsulate generic threading methods.
Users derive a class from SGThread and implement the run() member function.
Definition at line 42 of file SGThread.hxx.
SGThread::SGThread | ( | ) | [inline] |
Create a new thread object.
When a SGThread object is created it does not begin execution immediately. It is started by calling the start() member function.
Definition at line 120 of file SGThread.hxx.
SGThread::~SGThread | ( | ) | [inline, protected, virtual] |
Destroy a thread object.
This is protected so that its illegal to simply delete a thread
Definition at line 125 of file SGThread.hxx.
void SGThread::cancel | ( | ) | [inline] |
Sends a cancellation request to the underlying thread.
The target thread will either ignore the request, honor it immediately or defer it until it reaches a cancellation point.
Definition at line 151 of file SGThread.hxx.
virtual void SGThread::run | ( | ) | [protected, pure virtual] |
void SGThread::set_cancel | ( | cancel_t | mode | ) | [protected] |
Set the threads cancellation mode.
mode | The required cancellation mode. |
Definition at line 28 of file SGThread.cxx.
int SGThread::start | ( | unsigned | cpu = 0 |
) | [inline] |
Start the underlying thread of execution.
cpu | An optional parameter to specify on which CPU to run this thread (only supported on IRIX at this time). |
Definition at line 130 of file SGThread.hxx.