#include <OSGBaseThread.h>
Inheritance diagram for osg::BasePThreadBase:

Class Specific | |
| Char8 * | _szName |
| *static MPType | _type |
Public Types | |
| typedef void(* | ThreadFuncF )(void *pThreadArg) |
Public Member Functions | |
| bool | isInitialized (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 | |
Class Get | |
| *static const MPType & | getStaticType (void) |
| static UInt32 | getStaticTypeId (void) |
Protected Types | |
| typedef BaseThreadCommonBase | Inherited |
Protected Member Functions | |
Constructors | |
| * | BasePThreadBase (const Char8 *szName, UInt32 uiId) |
Destructors | |
| *virtual | ~BasePThreadBase (void) |
Construction | |
| *virtual void | init (void) |
| void | setupThread (void) |
| void | setupBlockCond (void) |
Run | |
| *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 Protected Member Functions | |
Helper | |
| *static void * | threadFunc (void *pThreadArg) |
| static void | freeThread (void *pThread) |
Get | |
| *static BaseThread * | getCurrent (void) |
Join | |
| *static void | join (BasePThreadBase *threadP) |
Protected Attributes | |
| UInt32 | _uiThreadId |
| bool | _bInitialized |
Instance Variables | |
| *void * | _pThreadData [3] |
| pthread_t * | _pThreadDesc |
| pthread_cond_t * | _pBlockCond |
| pthread_mutex_t * | _pBlockMutex |
Static Protected Attributes | |
| static pthread_key_t | _threadKey |
Private Member Functions | |
| BasePThreadBase (const BasePThreadBase &source) | |
| prohibit default function (move to 'public' if needed) | |
| void | operator= (const BasePThreadBase &source) |
| prohibit default function (move to 'public' if needed) | |
Friends | |
| class | ThreadManager |
Definition at line 141 of file OSGBaseThread.h.
|
|
Reimplemented from osg::BaseThreadCommonBase. Reimplemented in osg::BaseThread, osg::ThreadCommonBase, osg::PThreadBase, osg::Thread, and osg::ExternalThread. Definition at line 151 of file OSGBaseThread.h. |
|
|
Definition at line 90 of file OSGBaseThread.h. |
|
||||||||||||
|
Definition at line 147 of file OSGBaseThread.cpp. References _pThreadData. 00148 : 00149 Inherited (szName, uiId), 00150 00151 _pThreadDesc(NULL), 00152 _pBlockCond (NULL), 00153 _pBlockMutex(NULL) 00154 { 00155 _pThreadData[0] = NULL; 00156 _pThreadData[1] = NULL; 00157 _pThreadData[2] = NULL; 00158 }
|
|
|
Definition at line 163 of file OSGBaseThread.cpp. References _pThreadDesc. 00164 { 00165 delete _pThreadDesc; 00166 }
|
|
|
|
|
|
Definition at line 114 of file OSGBaseThread.cpp. Referenced by 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 }
|
|
|
Reimplemented in osg::PThreadBase. Definition at line 193 of file OSGBaseThread.cpp. References osg::BaseThreadCommonBase::_bInitialized, setupBlockCond(), and setupThread(). Referenced by osg::ThreadManager::init(). 00194 { 00195 if(_bInitialized == true) 00196 return; 00197 00198 setupThread (); 00199 setupBlockCond (); 00200 00201 _bInitialized = true; 00202 }
|
|
|
Definition at line 171 of file OSGBaseThread.cpp. References _threadKey. Referenced by 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 _pBlockCond, and _pBlockMutex. Referenced by 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 }
|
|
|
Reimplemented in osg::BaseThread, osg::Thread, and osg::ExternalThread. Definition at line 206 of file OSGBaseThread.cpp. References _threadKey. 00207 { 00208 #ifdef OSG_PTHREAD_ELF_TLS 00209 return _pLocalThread; 00210 #else 00211 BaseThread **pThread; 00212 00213 pThread = (BaseThread **) pthread_getspecific(_threadKey); 00214 00215 return *pThread; 00216 #endif 00217 }
|
|
|
Definition at line 221 of file OSGBaseThread.cpp. References _pThreadDesc. Referenced by osg::BaseThread::join(). 00222 { 00223 if(pThread != NULL && pThread->_pThreadDesc != NULL) 00224 { 00225 pthread_join(*(pThread->_pThreadDesc), NULL); 00226 } 00227 }
|
|
||||||||||||
|
Reimplemented in osg::BaseThread. Definition at line 233 of file OSGBaseThread.cpp. References osg::BaseThreadCommonBase::_bInitialized, _pThreadData, _pThreadDesc, SFATAL, and threadFunc(). Referenced by osg::BaseThread::run(), and osg::BaseThread::runFunction(). 00235 { 00236 bool returnValue = true; 00237 Int32 rc = 0; 00238 00239 _bInitialized = false; 00240 00241 if(fThreadFunc != NULL) 00242 { 00243 if(_pThreadDesc == NULL) 00244 _pThreadDesc = new pthread_t; 00245 00246 pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &rc); 00247 00248 _pThreadData[0] = (void *) fThreadFunc; 00249 _pThreadData[1] = pThreadArg; 00250 _pThreadData[2] = (void *) this; 00251 00252 pthread_attr_t threadAttr; 00253 pthread_attr_setscope(&threadAttr, PTHREAD_SCOPE_SYSTEM); 00254 00255 rc = pthread_create(_pThreadDesc, 00256 #if 0 00257 &threadAttr, 00258 #else 00259 NULL, 00260 #endif 00261 BasePThreadBase::threadFunc, 00262 (void *) &_pThreadData); 00263 00264 if(rc != 0) 00265 { 00266 SFATAL << "OSGPTB : pthread_create failed" << std::endl; 00267 returnValue = false; 00268 } 00269 } 00270 else 00271 { 00272 SFATAL << "OSGPTB : no thread function given"; 00273 returnValue = false; 00274 } 00275 00276 return returnValue; 00277 }
|
|
|
Reimplemented in osg::BaseThread. Definition at line 281 of file OSGBaseThread.cpp. References _pBlockCond, and _pBlockMutex. Referenced by osg::BaseThread::block(). 00282 { 00283 pthread_mutex_lock (_pBlockMutex); 00284 pthread_cond_wait (_pBlockCond, _pBlockMutex); 00285 pthread_mutex_unlock(_pBlockMutex); 00286 }
|
|
|
Reimplemented in osg::BaseThread. Definition at line 288 of file OSGBaseThread.cpp. References _pBlockCond. Referenced by osg::BaseThread::unblock(). 00289 { 00290 pthread_cond_broadcast(_pBlockCond); 00291 }
|
|
|
Reimplemented in osg::BaseThread. Definition at line 295 of file OSGBaseThread.cpp. Referenced by osg::BaseThread::exists().
|
|
|
Reimplemented in osg::BaseThread. Definition at line 300 of file OSGBaseThread.cpp. References _pThreadDesc. Referenced by osg::BaseThread::terminate(). 00301 { 00302 if(_pThreadDesc != NULL) 00303 pthread_cancel(*_pThreadDesc); 00304 }
|
|
|
Reimplemented in osg::BaseThread. Definition at line 306 of file OSGBaseThread.cpp. References _pThreadDesc. Referenced by osg::BaseThread::kill(). 00307 { 00308 if(_pThreadDesc != NULL) 00309 pthread_cancel(*_pThreadDesc); 00310 }
|
|
|
Reimplemented in osg::BaseThread. Definition at line 314 of file OSGBaseThread.cpp. References osg::MPBase::_szName, and osg::BaseThreadCommonBase::_uiThreadId. Referenced by osg::BaseThread::print(). 00315 { 00316 fprintf(stderr, "OSGPThreadBase -%s-%d-\n", _szName, _uiThreadId); 00317 }
|
|
|
|
|
|
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 }
|
|
|
Definition at line 64 of file OSGMemoryObject.cpp. References osg::MemoryObject::_refCount. Referenced by osg::SharedObjectHandler::getSharedObject(), and osg::SharedObjectHandler::initialize(). 00065 { 00066 _refCount++; 00067 }
|
|
|
Definition at line 69 of file OSGMemoryObject.cpp. References osg::MemoryObject::_refCount.
|
|
|
Definition at line 77 of file OSGMemoryObject.cpp. References osg::MemoryObject::_refCount. 00078 { 00079 return _refCount; 00080 }
|
|
|
Reimplemented from osg::BaseThreadCommonBase. Reimplemented in osg::BaseThread, osg::ThreadCommonBase, osg::PThreadBase, osg::Thread, and osg::ExternalThread. Definition at line 256 of file OSGBaseThread.h. |
|
|
Definition at line 107 of file OSGBaseThread.cpp. Referenced by getCurrent(), osg::BaseThread::initThreading(), and setupThread(). |
|
|
Definition at line 174 of file OSGBaseThread.h. Referenced by BasePThreadBase(), and runFunction(). |
|
|
Definition at line 175 of file OSGBaseThread.h. Referenced by join(), kill(), runFunction(), terminate(), and ~BasePThreadBase(). |
|
|
Definition at line 177 of file OSGBaseThread.h. Referenced by block(), setupBlockCond(), and unblock(). |
|
|
Definition at line 178 of file OSGBaseThread.h. Referenced by block(), and setupBlockCond(). |
|
|
Definition at line 100 of file OSGBaseThread.h. Referenced by print(). |
|
|
Definition at line 101 of file OSGBaseThread.h. Referenced by osg::PThreadBase::init(), init(), osg::ExternalThread::initialize(), osg::BaseThreadCommonBase::isInitialized(), and runFunction(). |
|
|
Reimplemented in osg::Barrier, osg::BaseThread, osg::Lock, osg::LockPool, osg::Thread, and osg::ExternalThread. Referenced by osg::MPBase::getStaticType(), and osg::MPBase::getType(). |
|
|
Definition at line 406 of file OSGMPBase.h. Referenced by osg::MPBase::getCName(), osg::LockPool::init(), osg::MPBase::MPBase(), print(), and osg::MPBase::~MPBase(). |
1.4.3