simgear  3.5.0 [next] git://
SimGear - Simulator Construction Tools
SGThread Class Referenceabstract

#include <SGThread.hxx>

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


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



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 ( )

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 )

Member Function Documentation

long SGThread::current ( void  )

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 LogStreamPrivate::stop().

SGThread& SGThread::operator= ( const SGThread )
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 LogStreamPrivate, simgear::SGTerraSync::SvnThread, 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.

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::SvnThread::start(), and LogStreamPrivate::startLog().

Friends And Related Function Documentation

friend struct PrivateData

Definition at line 80 of file SGThread.hxx.

Member Data Documentation

PrivateData* SGThread::_privateData

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: