#include <OSGBaseThread.h>
Inheritance diagram for OSG::BaseThread:

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 BaseThread * | get (const Char8 *szName) |
| static BaseThread * | find (const Char8 *szName) |
| static BaseThread * | create (void) |
| static const MPThreadType & | getClassType (void) |
Get | |
| static BaseThread * | getCurrent (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 BaseThread * | create (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 > |
Definition at line 571 of file OSGBaseThread.h.
typedef BaseThreadBase OSG::BaseThread::Inherited [private] |
| typedef MPThreadType OSG::BaseThread::Type |
Definition at line 583 of file OSGBaseThread.h.
| 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] |
| BaseThread * BaseThread::get | ( | const Char8 * | szName | ) | [static] |
Definition at line 637 of file OSGBaseThread.cpp.
References OSG::ThreadManager::getThread(), and OSG::ThreadManager::the().
Referenced by create(), OSG::PointMCastConnection::initialize(), OSG::GroupMCastConnection::initialize(), OSG::PipelineComposer::open(), and OSG::BinarySwapComposer::open().
00638 { 00639 return ThreadManager::the()->getThread(szName, "OSGBaseThread"); 00640 }
| 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] |
Definition at line 275 of file OSGBaseThread.inl.
Referenced by OSG::PipelineComposer::close(), OSG::BinarySwapComposer::close(), OSG::ProxyGroup::render(), OSG::ProxyGroup::startLoading(), OSG::GroupMCastConnection::write(), OSG::GroupMCastConnection::~GroupMCastConnection(), and OSG::PointMCastConnection::~PointMCastConnection().
| 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().
| void OSG::BaseThread::block | ( | void | ) | [inline] |
| void OSG::BaseThread::unblock | ( | void | ) | [inline] |
| bool OSG::BaseThread::exists | ( | void | ) | [inline] |
| void OSG::BaseThread::terminate | ( | void | ) | [inline] |
| void OSG::BaseThread::kill | ( | void | ) | [inline] |
| void BaseThread::print | ( | void | ) |
| 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] |
| void OSG::BaseThread::operator= | ( | const BaseThread & | source | ) | [private] |
friend class ThreadManager [friend] |
friend class MPFieldStore< BaseThread > [friend] |
Definition at line 689 of file OSGBaseThread.h.
MPThreadType BaseThread::_type [static, protected] |