OSG::BaseThread Class Reference

#include <OSGBaseThread.h>

Inheritance diagram for OSG::BaseThread:

OSG::ThreadCommonBase List of all members.

Public Types

typedef MPThreadType Type

Public Member Functions

Run


void run (void)
bool runFunction (ThreadFuncF fThreadFunc, void *pThreadArg)
Blocking


void block (void)
void unblock (void)
Helper


bool exists (void)
void terminate (void)
void kill (void)
Dump


void print (void)

Static Public Member Functions

Get


static BaseThreadget (const Char8 *szName)
static BaseThreadfind (const Char8 *szName)
static BaseThreadcreate (void)
static const MPThreadTypegetClassType (void)
Get


static BaseThreadgetCurrent (void)
Join


static void join (BaseThread *pThread)

Protected Member Functions

Constructors


 BaseThread (const Char8 *szName, UInt32 uiId)
Destructors


virtual ~BaseThread (void)
Workproc


virtual void workProc (void)

Static Protected Member Functions

Class Specific


static BaseThreadcreate (const Char8 *szName, UInt32 uiId)
static void initThreading (void)
static void terminateThreading (void)
static void runWorkProc (void *pThread)

Static Protected Attributes

static MPThreadType _type

Private Types

typedef BaseThreadBase Inherited

Private Member Functions

 BaseThread (const BaseThread &source)
 prohibit default function (move to 'public' if needed)
void operator= (const BaseThread &source)
 prohibit default function (move to 'public' if needed)

Friends

class ThreadManager
class MPFieldStore< BaseThread >

Detailed Description

Definition at line 571 of file OSGBaseThread.h.


Member Typedef Documentation

typedef BaseThreadBase OSG::BaseThread::Inherited [private]

Reimplemented in OSG::ThreadCommonBase.

Definition at line 577 of file OSGBaseThread.h.

Definition at line 583 of file OSGBaseThread.h.


Constructor & Destructor Documentation

BaseThread::BaseThread ( const Char8 *  szName,
UInt32  uiId 
) [protected]

Definition at line 707 of file OSGBaseThread.cpp.

Referenced by create().

00707                                                        :
00708     Inherited(szName, uiId)
00709 {
00710 }

BaseThread::~BaseThread ( void   )  [protected, virtual]

Definition at line 714 of file OSGBaseThread.cpp.

References OSG::ThreadManager::getAppThread(), OSG::ThreadManager::removeThread(), terminate(), and OSG::ThreadManager::the().

00715 {
00716     shutdown();
00717 
00718     ThreadManager::the()->removeThread(this);
00719 
00720     if(this != ThreadManager::getAppThread())
00721         terminate();
00722 }

OSG::BaseThread::BaseThread ( const BaseThread source  )  [private]


Member Function Documentation

BaseThread * BaseThread::get ( const Char8 *  szName  )  [static]

BaseThread * BaseThread::find ( const Char8 *  szName  )  [static]

Definition at line 642 of file OSGBaseThread.cpp.

References OSG::ThreadManager::findThread(), and OSG::ThreadManager::the().

00643 {
00644     return ThreadManager::the()->findThread(szName);
00645 }

BaseThread * OSG::BaseThread::create ( void   )  [inline, static]

Definition at line 253 of file OSGBaseThread.inl.

References get().

00254 {
00255     return BaseThread::get(NULL);
00256 }

const MPThreadType & OSG::BaseThread::getClassType ( void   )  [inline, static]

Definition at line 259 of file OSGBaseThread.inl.

References _type.

00260 {
00261     return _type;
00262 }

BaseThread * OSG::BaseThread::getCurrent ( void   )  [inline, static]

Definition at line 267 of file OSGBaseThread.inl.

References OSG::Directory::getCurrent().

00268 {
00269     return Inherited::getCurrent();
00270 }

void OSG::BaseThread::join ( BaseThread pThread  )  [inline, static]

void OSG::BaseThread::run ( void   )  [inline]

Definition at line 284 of file OSGBaseThread.inl.

References runWorkProc().

00285 {
00286     Inherited::runFunction(runWorkProc, this);
00287 }

bool OSG::BaseThread::runFunction ( ThreadFuncF  fThreadFunc,
void *  pThreadArg 
) [inline]

Definition at line 290 of file OSGBaseThread.inl.

Referenced by OSG::PointMCastConnection::initialize(), OSG::GroupMCastConnection::initialize(), OSG::PipelineComposer::open(), and OSG::BinarySwapComposer::open().

00292 {
00293     return Inherited::runFunction(fThreadFunc, pThreadArg);
00294 }

void OSG::BaseThread::block ( void   )  [inline]

Definition at line 299 of file OSGBaseThread.inl.

00300 {
00301     Inherited::block();
00302 }

void OSG::BaseThread::unblock ( void   )  [inline]

Definition at line 305 of file OSGBaseThread.inl.

00306 {
00307     Inherited::unblock();
00308 }

bool OSG::BaseThread::exists ( void   )  [inline]

Definition at line 313 of file OSGBaseThread.inl.

00314 {
00315     return Inherited::exists();
00316 }

void OSG::BaseThread::terminate ( void   )  [inline]

Definition at line 319 of file OSGBaseThread.inl.

Referenced by ~BaseThread().

00320 {
00321     Inherited::terminate();
00322 }

void OSG::BaseThread::kill ( void   )  [inline]

Definition at line 325 of file OSGBaseThread.inl.

00326 {
00327     Inherited::kill();
00328 }

void BaseThread::print ( void   ) 

Definition at line 630 of file OSGBaseThread.cpp.

00631 {
00632     Inherited::print();
00633 }

BaseThread * BaseThread::create ( const Char8 *  szName,
UInt32  uiId 
) [static, protected]

Definition at line 649 of file OSGBaseThread.cpp.

References BaseThread().

00650 {
00651     return new BaseThread(szName, uiId);
00652 }

void BaseThread::initThreading ( void   )  [static, protected]

Definition at line 654 of file OSGBaseThread.cpp.

References FFASSERT, and FINFO.

00655 {
00656     FINFO(("BaseThread::initThreading\n"))
00657 
00658 #if defined(OSG_USE_PTHREADS) && !defined(OSG_PTHREAD_ELF_TLS)
00659     int rc;
00660 
00661     rc = pthread_key_create(&(BaseThread::_threadKey), NULL);
00662 //                              BaseThread::freeThread);
00663 
00664     FFASSERT((rc == 0), 1, ("Failed to create pthread thread key\n");)
00665 #endif
00666 
00667 #if defined(OSG_USE_WINTHREADS) && defined(OSG_WIN32_ASPECT_USE_LOCALSTORAGE)
00668     BaseThread::_threadKey     = TlsAlloc();
00669 
00670     FFASSERT((BaseThread::_threadKey != 0xFFFFFFFF), 1,
00671              ("Failed to alloc thread key local storage\n");)
00672 #endif
00673 }

void BaseThread::terminateThreading ( void   )  [static, protected]

Definition at line 675 of file OSGBaseThread.cpp.

References FFASSERT.

00676 {
00677 // free threading resources
00678 #if 0
00679 #if defined(OSG_USE_PTHREADS) && !defined(OSG_PTHREAD_ELF_TLS)
00680     int rc;
00681 
00682     rc = pthread_key_create(&(BaseThread::_threadKey),
00683                               BaseThread::freeThread);
00684 
00685     FFASSERT((rc == 0), 1, ("Failed to create pthread thread key\n");)
00686 #endif
00687 
00688 #if defined(OSG_USE_WINTHREADS) && defined (OSG_WIN32_ASPECT_USE_LOCALSTORAGE)
00689     BaseThread::_threadKey     = TlsAlloc();
00690 
00691     FFASSERT((BaseThread::_threadKey != 0xFFFFFFFF), 1,
00692              ("Failed to alloc thread key local storage\n");)
00693 #endif
00694 #endif
00695 }

void BaseThread::runWorkProc ( void *  pThread  )  [static, protected]

Definition at line 697 of file OSGBaseThread.cpp.

References workProc().

Referenced by run().

00698 {
00699     if(pThread != NULL)
00700     {
00701         static_cast<BaseThread *>(pThread)->workProc();
00702     }
00703 }

void BaseThread::workProc ( void   )  [protected, virtual]

Definition at line 726 of file OSGBaseThread.cpp.

Referenced by runWorkProc().

00727 {
00728 }

void OSG::BaseThread::operator= ( const BaseThread source  )  [private]


Friends And Related Function Documentation

friend class ThreadManager [friend]

Reimplemented in OSG::ThreadCommonBase.

Definition at line 688 of file OSGBaseThread.h.

friend class MPFieldStore< BaseThread > [friend]

Definition at line 689 of file OSGBaseThread.h.


Member Data Documentation

MPThreadType BaseThread::_type [static, protected]

Definition at line 649 of file OSGBaseThread.h.

Referenced by getClassType().


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