SGThread Class Reference

Encapsulate generic threading methods. More...

#include <SGThread.hxx>

List of all members.

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.

Detailed Description

Encapsulate generic threading methods.

Users derive a class from SGThread and implement the run() member function.

Definition at line 42 of file SGThread.hxx.


Constructor & Destructor Documentation

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

  • it must return from its run() function.

Definition at line 125 of file SGThread.hxx.


Member Function Documentation

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]

All threads execute by deriving the run() method of SGThread.

If this function terminates then the thread also terminates.

void SGThread::set_cancel ( cancel_t  mode  )  [protected]

Set the threads cancellation mode.

Parameters:
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.

Parameters:
cpu An optional parameter to specify on which CPU to run this thread (only supported on IRIX at this time).
Returns:
Pthread error code if execution fails, otherwise returns 0.

Definition at line 130 of file SGThread.hxx.


The documentation for this class was generated from the following files:

Generated on 23 Feb 2010 for SimGear by  doxygen 1.6.1