SimGear - Simulator Construction Tools
SGThread Class Referenceabstract

#include <SGThread.hxx>

Inheritance diagram for SGThread:
anonymous_namespace{raw_socket.cxx}::Resolver logstream::LogStreamPrivate simgear::SGTerraSync::WorkerThread simgear::BVHPager::_PrivateData

Classes

struct  PrivateData
 posix threads More...
 

Public Member Functions

 SGThread ()
 
void join ()
 
bool start ()
 

Static Public Member Functions

static long current (void)
 

Protected Member Functions

virtual ~SGThread ()
 
virtual void run ()=0
 

Private Member Functions

 SGThread (const SGThread &)
 
SGThreadoperator= (const SGThread &)
 

Private Attributes

PrivateData_privateData
 

Friends

struct PrivateData
 

Detailed Description

Encapsulate generic threading methods. Users derive a class from SGThread and implement the run() member function.

Definition at line 32 of file SGThread.hxx.

Constructor & Destructor Documentation

SGThread::SGThread ( )

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 339 of file SGThread.cxx.

SGThread::~SGThread ( )
protectedvirtual

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 344 of file SGThread.cxx.

SGThread::SGThread ( const SGThread )
private

Member Function Documentation

long SGThread::current ( void  )
static

Retreive the current thread id.

Definition at line 234 of file SGThread.cxx.

void SGThread::join ( )

Suspends the exection of the calling thread until this thread terminates.

Definition at line 357 of file SGThread.cxx.

Referenced by simgear::BVHPager::_PrivateData::_stop(), and logstream::LogStreamPrivate::stop().

SGThread& SGThread::operator= ( const SGThread )
private
virtual void SGThread::run ( )
protectedpure virtual

All threads execute by deriving the run() method of SGThread. If this function terminates then the thread also terminates.

Implemented in logstream::LogStreamPrivate, simgear::SGTerraSync::WorkerThread, anonymous_namespace{raw_socket.cxx}::Resolver, and simgear::BVHPager::_PrivateData.

Referenced by SGThread::PrivateData::start_routine().

bool SGThread::start ( )

Start the underlying thread of execution.

Returns
Pthread error code if execution fails, otherwise returns 0.

Definition at line 351 of file SGThread.cxx.

Referenced by simgear::BVHPager::_PrivateData::_start(), simgear::SGTerraSync::WorkerThread::start(), and logstream::LogStreamPrivate::startLog().

Friends And Related Function Documentation

friend struct PrivateData
friend

Definition at line 80 of file SGThread.hxx.

Member Data Documentation

PrivateData* SGThread::_privateData
private

Definition at line 77 of file SGThread.hxx.

Referenced by join(), start(), and ~SGThread().


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