#include <OSGThread.h>
Inheritance diagram for osg::ExternalThread:

Public Types | |
| typedef MPThreadType | Type |
| typedef void(* | ThreadFuncF )(void *pThreadArg) |
Public Member Functions | |
| bool | isInitialized (void) |
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) |
Get | |
| *virtual MPType & | getType (void) |
| virtual const MPType & | getType (void) const |
| UInt32 | getTypeId (void) |
| const Char8 * | getCName (void) const |
Reference Counting | |
| *void | addRef (void) |
| void | subRef (void) |
| Int32 | getRefCount (void) |
Get | |
| *void | initialize (UInt32 uiAspectId) |
Run | |
| *bool | runFunction (ThreadFuncF fThreadFunc, UInt32 uiAspectId, void *pThreadArg) |
Run | |
| bool | runFunction (ThreadFuncF fThreadFunc, void *pThreadArg) |
| *void | run (void) |
Get | |
| *ChangeList * | getChangeList (void) |
Blocking | |
| *void | block (void) |
| void | unblock (void) |
Helper | |
| *bool | exists (void) |
| void | terminate (void) |
| void | kill (void) |
Dump | |
| *void | print (void) |
Get | |
| *virtual MPType & | getType (void) |
| virtual const MPType & | getType (void) const |
| UInt32 | getTypeId (void) |
| const Char8 * | getCName (void) const |
Reference Counting | |
| *void | addRef (void) |
| void | subRef (void) |
| Int32 | getRefCount (void) |
Static Public Member Functions | |
Join | |
| *static void | join (BaseThread *pThread) |
Class Get | |
| *static const MPType & | getStaticType (void) |
| static UInt32 | getStaticTypeId (void) |
Get | |
| *static PthreadBase * | getCurrent (void) |
| static ExternalThread * | get (const Char8 *szName) |
| static ExternalThread * | find (const Char8 *szName) |
Get | |
| *static UInt32 | getAspect (void) |
| static ChangeList * | getCurrentChangeList (void) |
Get | |
| static BaseThread * | create (void) |
| static const MPThreadType & | getClassType (void) |
Join | |
| *static void | join (BaseThread *pThread) |
Class Get | |
| *static const MPType & | getStaticType (void) |
| static UInt32 | getStaticTypeId (void) |
Static Public Attributes | |
| static const UInt32 | InvalidAspect |
Protected Types | |
| typedef PthreadBase | Inherited |
Protected Member Functions | |
Workproc | |
| *virtual void | workProc (void) |
Constructors | |
| * | ExternalThread (const Char8 *szName, UInt32 uiId) |
Destructor | |
| *virtual | ~ExternalThread (void) |
Setup | |
| *virtual void | init (void) |
| void | setupAspect (void) |
| void | setupChangeList (void) |
Set | |
| *void | setAspect (UInt32 uiAspectId) |
| void | setChangeList (ChangeList *pChangeList) |
Workproc | |
| *virtual void | workProc (void) |
Construction | |
| void | setupThread (void) |
| void | setupBlockCond (void) |
Static Protected Member Functions | |
Helper | |
| *static void * | threadFunc (void *pThreadArg) |
| static void | freeThread (void *pThread) |
Join | |
| *static void | join (BasePThreadBase *threadP) |
Init | |
| *static ExternalThread * | create (const Char8 *szName, UInt32 uiId) |
Free | |
| *static void | freeAspect (void *pAspect) |
| static void | freeChangeList (void *pChangeList) |
Join | |
| *static void | join (BasePThreadBase *threadP) |
Class Specific | |
| static void | initThreading (void) |
| static void | runWorkProc (void *pThread) |
Helper | |
| *static void * | threadFunc (void *pThreadArg) |
| static void | freeThread (void *pThread) |
Protected Attributes | |
| UInt32 | _uiThreadId |
| bool | _bInitialized |
Instance Variables | |
| *void * | _pThreadData [3] |
| pthread_t * | _pThreadDesc |
| pthread_cond_t * | _pBlockCond |
| pthread_mutex_t * | _pBlockMutex |
Class Specific | |
| Char8 * | _szName |
Member | |
| *UInt32 | _uiAspectId |
| ChangeList * | _pChangeList |
Instance Variables | |
| *void * | _pThreadData [3] |
| pthread_t * | _pThreadDesc |
| pthread_cond_t * | _pBlockCond |
| pthread_mutex_t * | _pBlockMutex |
Class Specific | |
| Char8 * | _szName |
Static Protected Attributes | |
| static pthread_key_t | _threadKey |
Member | |
| *static MPThreadType | _type |
Member | |
| *static pthread_key_t | _aspectKey |
| static pthread_key_t | _changeListKey |
Private Member Functions | |
| ExternalThread (const ExternalThread &source) | |
| prohibit default function (move to 'public' if needed) | |
| void | operator= (const ExternalThread &source) |
| prohibit default function (move to 'public' if needed) | |
Friends | |
| class | ThreadManager |
| class | MPFieldStore< BaseThread > |
Definition at line 553 of file OSGThread.h.
|
|
Reimplemented from osg::BaseThread. Definition at line 559 of file OSGThread.h. |
|
|
Reimplemented from osg::PThreadBase. Definition at line 582 of file OSGThread.h. |
|
|
Definition at line 90 of file OSGBaseThread.h. |
|
||||||||||||
|
Definition at line 760 of file OSGThread.cpp. Referenced by create(). 00760 : 00761 Inherited(szName, uiId) 00762 { 00763 }
|
|
|
Definition at line 768 of file OSGThread.cpp.
|
|
|
|
|
|
Reimplemented from osg::BaseThread. Definition at line 671 of file OSGThread.cpp. References osg::Directory::getCurrent(). 00672 { 00673 return static_cast<ThreadBase *>(Inherited::getCurrent()); 00674 }
|
|
|
Reimplemented from osg::BaseThread. Definition at line 676 of file OSGThread.cpp. References osg::ThreadManager::getThread(), and osg::ThreadManager::the(). 00677 { 00678 BaseThread *pThread = ThreadManager::the()->getThread(szName, 00679 "OSGExternalThread"); 00680 00681 return dynamic_cast<ExternalThread *>(pThread); 00682 }
|
|
|
Reimplemented from osg::BaseThread. Definition at line 684 of file OSGThread.cpp. References osg::ThreadManager::findThread(), and osg::ThreadManager::the(). 00685 { 00686 BaseThread *pThread = ThreadManager::the()->findThread(szName); 00687 00688 return dynamic_cast<ExternalThread *>(pThread); 00689 }
|
|
|
Definition at line 691 of file OSGThread.cpp. References osg::BaseThreadCommonBase::_bInitialized, osg::PThreadBase::init(), and osg::ThreadCommonBase::setAspect(). 00692 { 00693 if(_bInitialized == true) 00694 return; 00695 00696 Inherited::setAspect(uiAspectId); 00697 00698 this->init(); 00699 }
|
|
||||||||||||
|
Reimplemented from osg::BaseThread. Definition at line 704 of file OSGThread.cpp. References ExternalThread(). 00706 { 00707 return new ExternalThread(szName, uiId); 00708 }
|
|
|
|
|
|
|
Definition at line 147 of file OSGThread.cpp. References osg::PThreadBase::_changeListKey. Referenced by osg::FieldContainerPtrBase::addRef(), osg::FieldContainerPtrBase::deleteContainers(), osg::FieldContainerPtr::endEditNotChanged(), osg::ClusterWindow::frameInit(), osg::FieldContainer::newPtr(), and osg::FieldContainerPtrBase::subRef(). 00148 { 00149 #if defined(OSG_PTHREAD_ELF_TLS) 00150 return _pTLSChangeList; 00151 #else 00152 ChangeList **pCList; 00153 00154 pCList = (ChangeList **) pthread_getspecific(_changeListKey); 00155 00156 return *pCList; 00157 #endif 00158 }
|
|
||||||||||||||||
|
Definition at line 165 of file OSGThread.cpp. References osg::ThreadManager::getNumAspects(), osg::BaseThread::runFunction(), osg::ThreadCommonBase::setAspect(), and SFATAL. Referenced by osg::Thread::run(), osg::ProxyGroup::startLoading(), osg::SceneFileHandler::startReadProgressThread(), and osg::startSceneGraphViewThread(). 00168 { 00169 if(uiAspectId >= ThreadManager::getNumAspects()) 00170 { 00171 SFATAL << "OSGPTB : invalid aspect id" << std::endl; 00172 return false; 00173 } 00174 00175 Inherited::setAspect(uiAspectId); 00176 00177 return Inherited::runFunction(fThreadFunc, pThreadArg); 00178 }
|
|
||||||||||||
|
Reimplemented from osg::BasePThreadBase. Definition at line 794 of file OSGBaseThread.cpp. References osg::BasePThreadBase::runFunction(). Referenced by osg::PointMCastConnection::initialize(), osg::GroupMCastConnection::initialize(), and osg::PThreadBase::runFunction(). 00796 { 00797 return Inherited::runFunction(fThreadFunc, pThreadArg); 00798 }
|
|
|
Definition at line 184 of file OSGThread.cpp. Referenced by osg::Thread::initThreading(), and osg::ThreadManager::shutdown(). 00185 { 00186 UInt32 *pUint = (UInt32 *) pAspect; 00187 00188 if(pUint != NULL) 00189 delete pUint; 00190 }
|
|
|
Definition at line 192 of file OSGThread.cpp. Referenced by osg::Thread::initThreading(), and osg::ThreadManager::shutdown(). 00193 { 00194 ChangeList **pCl = (ChangeList **) pChangeList; 00195 00196 if(pCl != NULL) 00197 delete pCl; 00198 }
|
|
|
Reimplemented from osg::BasePThreadBase. Definition at line 220 of file OSGThread.cpp. References osg::BaseThreadCommonBase::_bInitialized, init(), osg::PThreadBase::setupAspect(), and osg::PThreadBase::setupChangeList(). Referenced by initialize(). 00221 { 00222 if(_bInitialized == true) 00223 return; 00224 00225 Inherited::init(); 00226 00227 if(_bInitialized == true) 00228 { 00229 setupAspect (); 00230 setupChangeList(); 00231 } 00232 }
|
|
|
Definition at line 235 of file OSGThread.cpp. References osg::PThreadBase::_aspectKey, and osg::ThreadCommonBase::_uiAspectId. Referenced by osg::PThreadBase::init(). 00236 { 00237 00238 #if defined(OSG_PTHREAD_ELF_TLS) 00239 _uiTLSAspectId = Inherited::_uiAspectId; 00240 #else 00241 UInt32 *pUint = new UInt32; 00242 00243 *pUint = Inherited::_uiAspectId; 00244 00245 pthread_setspecific(_aspectKey, (void *) pUint); 00246 #endif 00247 }
|
|
|
Definition at line 249 of file OSGThread.cpp. References osg::PThreadBase::_changeListKey, osg::ThreadCommonBase::_pChangeList, osg::ThreadCommonBase::_uiAspectId, osg::ChangeList::clearAll(), and osg::ThreadCommonBase::setChangeList(). Referenced by osg::PThreadBase::init(). 00250 { 00251 #if defined(OSG_PTHREAD_ELF_TLS) 00252 if(Inherited::_pChangeList == NULL) 00253 { 00254 _pTLSChangeList = new ChangeList; 00255 00256 Inherited::setChangeList(_pTLSChangeList); 00257 } 00258 else 00259 { 00260 _pTLSChangeList = Inherited::_pChangeList; 00261 00262 _pTLSChangeList->clearAll(); 00263 } 00264 00265 _pTLSChangeList->setAspect(Inherited::_uiAspectId); 00266 #else 00267 ChangeList **pChangeList = new ChangeList *; 00268 00269 if(Inherited::_pChangeList == NULL) 00270 { 00271 *pChangeList = new ChangeList; 00272 00273 Inherited::setChangeList(*pChangeList); 00274 } 00275 else 00276 { 00277 *pChangeList = Inherited::_pChangeList; 00278 00279 (*pChangeList)->clearAll(); 00280 } 00281 00282 (*pChangeList)->setAspect(Inherited::_uiAspectId); 00283 pthread_setspecific(_changeListKey, (void *) pChangeList); 00284 #endif 00285 }
|
|
|
Definition at line 77 of file OSGThread.cpp. References osg::ThreadCommonBase::_pChangeList. 00078 { 00079 return _pChangeList; 00080 }
|
|
|
Definition at line 107 of file OSGThread.cpp. References osg::ThreadCommonBase::_uiAspectId. Referenced by initialize(), and osg::PThreadBase::runFunction(). 00108 { 00109 _uiAspectId = uiAspectId; 00110 }
|
|
|
Definition at line 112 of file OSGThread.cpp. References osg::ThreadCommonBase::_pChangeList, and osg::setRefP(). Referenced by osg::PThreadBase::setupChangeList(). 00113 { 00114 setRefP(_pChangeList, pChangeList); 00115 }
|
|
|
Definition at line 762 of file OSGBaseThread.cpp. References osg::BaseThread::get(). 00763 { 00764 return BaseThread::get(NULL); 00765 }
|
|
|
Definition at line 767 of file OSGBaseThread.cpp. References osg::BaseThread::_type. Referenced by osg::ThreadManager::init(). 00768 { 00769 return _type; 00770 }
|
|
|
Definition at line 781 of file OSGBaseThread.cpp. References osg::BasePThreadBase::join(). Referenced by osg::ProxyGroup::draw(), osg::ProxyGroup::startLoading(), osg::SceneFileHandler::stopReadProgressThread(), osg::GroupMCastConnection::write(), osg::GroupMCastConnection::~GroupMCastConnection(), and osg::PointMCastConnection::~PointMCastConnection(). 00782 { 00783 Inherited::join(pThread); 00784 }
|
|
|
Definition at line 221 of file OSGBaseThread.cpp. References osg::BasePThreadBase::_pThreadDesc. Referenced by osg::BaseThread::join(). 00222 { 00223 if(pThread != NULL && pThread->_pThreadDesc != NULL) 00224 { 00225 pthread_join(*(pThread->_pThreadDesc), NULL); 00226 } 00227 }
|
|
|
Definition at line 789 of file OSGBaseThread.cpp. References osg::BasePThreadBase::runFunction(), and osg::BaseThread::runWorkProc(). 00790 { 00791 Inherited::runFunction(runWorkProc, this); 00792 }
|
|
|
Reimplemented from osg::BasePThreadBase. Definition at line 802 of file OSGBaseThread.cpp. References osg::BasePThreadBase::block(). 00803 { 00804 Inherited::block(); 00805 }
|
|
|
Reimplemented from osg::BasePThreadBase. Definition at line 807 of file OSGBaseThread.cpp. References osg::BasePThreadBase::unblock(). 00808 { 00809 Inherited::unblock(); 00810 }
|
|
|
Reimplemented from osg::BasePThreadBase. Definition at line 814 of file OSGBaseThread.cpp. References osg::BasePThreadBase::exists(). 00815 { 00816 return Inherited::exists(); 00817 }
|
|
|
Reimplemented from osg::BasePThreadBase. Definition at line 820 of file OSGBaseThread.cpp. References osg::BasePThreadBase::terminate(). Referenced by osg::BaseThread::~BaseThread(). 00821 { 00822 Inherited::terminate(); 00823 }
|
|
|
Reimplemented from osg::BasePThreadBase. Definition at line 825 of file OSGBaseThread.cpp. References osg::BasePThreadBase::kill(). 00826 { 00827 Inherited::kill(); 00828 }
|
|
|
Reimplemented from osg::BasePThreadBase. Definition at line 832 of file OSGBaseThread.cpp. References osg::BasePThreadBase::print(). 00833 { 00834 Inherited::print(); 00835 }
|
|
|
Reimplemented in osg::Thread. Definition at line 844 of file OSGBaseThread.cpp. References osg::BasePThreadBase::_threadKey, FFASSERT, FINFO, and osg::BasePThreadBase::freeThread(). 00845 { 00846 FINFO(("BaseThread::initThreading\n")) 00847 00848 #if defined(OSG_USE_PTHREADS) && !defined(OSG_PTHREAD_ELF_TLS) 00849 int rc; 00850 00851 rc = pthread_key_create(&(BaseThread::_threadKey), 00852 BaseThread::freeThread); 00853 00854 FFASSERT((rc == 0), 1, ("Failed to create pthread thread key\n");) 00855 #endif 00856 00857 #if defined(OSG_USE_WINTHREADS) && defined (OSG_ASPECT_USE_LOCALSTORAGE) 00858 BaseThread::_threadKey = TlsAlloc(); 00859 00860 FFASSERT((BaseThread::_threadKey != 0xFFFFFFFF), 1, 00861 ("Failed to alloc thread key local storage\n");) 00862 #endif 00863 }
|
|
|
Definition at line 865 of file OSGBaseThread.cpp. Referenced by osg::Thread::run(), and osg::BaseThread::run(). 00866 { 00867 if(pThread != NULL) 00868 { 00869 static_cast<BaseThread *>(pThread)->workProc(); 00870 } 00871 }
|
|
|
Definition at line 893 of file OSGBaseThread.cpp.
|
|
|
Definition at line 114 of file OSGBaseThread.cpp. Referenced by osg::BasePThreadBase::runFunction(). 00115 { 00116 void **pArgs = (void **) pThreadArg; 00117 00118 if(pArgs != NULL) 00119 { 00120 if(pArgs[2] != NULL) 00121 { 00122 ((BaseThread *) pArgs[2])->init(); 00123 00124 if(pArgs[0] != NULL) 00125 { 00126 ThreadFuncF fThreadFunc = (ThreadFuncF) pArgs[0]; 00127 00128 fThreadFunc(pArgs[1]); 00129 } 00130 } 00131 } 00132 00133 return NULL; 00134 }
|
|
|
Definition at line 137 of file OSGBaseThread.cpp. Referenced by osg::BaseThread::initThreading(), and osg::ThreadManager::shutdown(). 00138 { 00139 BaseThread **pT = static_cast<BaseThread **>(pThread); 00140 00141 delete pT; 00142 }
|
|
|
Definition at line 171 of file OSGBaseThread.cpp. References osg::BasePThreadBase::_threadKey. Referenced by osg::BasePThreadBase::init(). 00172 { 00173 #ifdef OSG_PTHREAD_ELF_TLS 00174 _pLocalThread = static_cast<BaseThread *>(this); 00175 #else 00176 BaseThread **pThread = new BaseThread *; 00177 00178 *pThread = (BaseThread *) this; 00179 00180 pthread_setspecific(_threadKey, (void *) pThread); 00181 #endif 00182 }
|
|
|
Definition at line 184 of file OSGBaseThread.cpp. References osg::BasePThreadBase::_pBlockCond, and osg::BasePThreadBase::_pBlockMutex. Referenced by osg::BasePThreadBase::init(). 00185 { 00186 _pBlockCond = new pthread_cond_t; 00187 _pBlockMutex = new pthread_mutex_t; 00188 00189 pthread_cond_init (_pBlockCond, NULL); 00190 pthread_mutex_init(_pBlockMutex, NULL); 00191 }
|
|
|
Definition at line 73 of file OSGBaseThread.cpp. References osg::BaseThreadCommonBase::_bInitialized. 00074 { 00075 return _bInitialized; 00076 }
|
|
|
Definition at line 253 of file OSGMPBase.cpp. References osg::MPBase::_type. 00254 { 00255 return _type; 00256 }
|
|
|
Definition at line 259 of file OSGMPBase.cpp.
|
|
|
Definition at line 265 of file OSGMPBase.cpp. References osg::MPBase::_type. Referenced by osg::MPBase::getTypeId(). 00266 { 00267 return _type; 00268 }
|
|
|
Definition at line 271 of file OSGMPBase.cpp. References osg::MPBase::_type. 00272 { 00273 return _type; 00274 }
|
|
|
Definition at line 277 of file OSGMPBase.cpp. References osg::TypeBase::getId(), and osg::MPBase::getType().
|
|
|
Definition at line 283 of file OSGMPBase.cpp. References osg::MPBase::_szName. 00284 { 00285 return _szName; 00286 }
|
|