osg::ThreadManager Class Reference
[Multithreading]

#include <OSGThreadManager.h>

List of all members.

Instance Variables



static Char8_szAppThreadType = NULL
ThreadStore _sThreadStore
BarrierStore _sBarrierStore
LockStore _sLockStore
LockPoolStore _sLockPoolStore
Lock_storePLock

Public Types

Types


typedef MPFieldStore< BaseThreadThreadStore
typedef MPFieldStore< BarrierBarrierStore
typedef MPFieldStore< LockLockStore
typedef MPFieldStore< LockPoolLockPoolStore

Public Member Functions

Create Threading Element


BaseThreadgetThread (const Char8 *szName, const Char8 *szTypeName="OSGThread")
BarriergetBarrier (const Char8 *szName, const Char8 *szTypeName="OSGBarrier")
LockgetLock (const Char8 *szName, const Char8 *szTypeName="OSGLock")
LockPoolgetLockPool (const Char8 *szName, const Char8 *szTypeName="OSGLockPool")
BaseThreadfindThread (const Char8 *szName)
BarrierfindBarrier (const Char8 *szName)
LockfindLock (const Char8 *szName)
LockPoolfindLockPool (const Char8 *szName)

Static Public Member Functions

Set / Get


static void setAppThreadType (const Char8 *szAppThreadType)
static ThreadManagerthe (void)
static BaseThreadgetAppThread (void)
static void setNumAspects (UInt32 uiNumApects)
static UInt32 getNumAspects (void)

Protected Member Functions

void removeThread (BaseThread *pThread)
void removeBarrier (Barrier *pBarrier)
void removeLock (Lock *pLock)
void removeLockPool (LockPool *pLockPool)
UInt32 registerThreadType (MPThreadType *pType)
UInt32 registerBarrierType (MPBarrierType *pType)
UInt32 registerLockType (MPLockType *pType)
UInt32 registerLockPoolType (MPLockPoolType *pType)
bool init (void)
bool shutdown (void)
Constructors


 ThreadManager (void)
Destructor


virtual ~ThreadManager (void)

Static Protected Member Functions

static bool initialize (void)
static bool terminate (void)

Private Member Functions

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

Static Private Attributes

Class Variable


static ThreadManager_pThreadManager = NULL
static BaseThread_pAppThread = NULL
static bool _bShutdownInProgress = false
static UInt32 _uiNumAspects = OSG_NUM_ASPECTS

Friends

Friend Classes


class MPThreadType
class MPBarrierType
class MPLockType
class MPLockPoolType
class BaseThread
class Barrier
class Lock
class LockPool
bool osgInit (Int32 argc, Char8 **argv, UInt16 major, UInt16 minor, UInt16 release, bool debug, bool dll, bool mt)
bool osgExit (void)


Detailed Description

Definition at line 166 of file OSGThreadManager.h.


Member Typedef Documentation

Definition at line 176 of file OSGThreadManager.h.

Definition at line 177 of file OSGThreadManager.h.

Definition at line 178 of file OSGThreadManager.h.

Definition at line 179 of file OSGThreadManager.h.


Constructor & Destructor Documentation

ThreadManager::ThreadManager ( void   )  [protected]

Definition at line 421 of file OSGThreadManager.cpp.

Referenced by the().

00421                                  :
00422     _sThreadStore  (),
00423     _sBarrierStore (),
00424     _sLockStore    (),
00425     _sLockPoolStore(),
00426 
00427     _storePLock    (NULL)
00428 {
00429 #if defined(OSG_USE_SPROC)
00430     _pArena = NULL;
00431 #endif
00432 }

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

Definition at line 436 of file OSGThreadManager.cpp.

00437 {
00438 }

osg::ThreadManager::ThreadManager ( const ThreadManager source  )  [private]


Member Function Documentation

void ThreadManager::setAppThreadType ( const Char8 szAppThreadType  )  [static]

Definition at line 66 of file OSGThreadManager.cpp.

References _szAppThreadType, and osg::stringDup().

Referenced by osg::Thread::initThreading().

00067 {
00068     stringDup(szAppThreadType, _szAppThreadType);
00069 }

ThreadManager * ThreadManager::the ( void   )  [static]

BaseThread * ThreadManager::getAppThread ( void   )  [static]

Definition at line 81 of file OSGThreadManager.cpp.

References _pAppThread.

Referenced by osg::BaseThread::~BaseThread().

00082 {
00083     return _pAppThread;
00084 }

void ThreadManager::setNumAspects ( UInt32  uiNumApects  )  [static]

Definition at line 87 of file OSGThreadManager.cpp.

References _uiNumAspects.

00088 {
00089 #if defined(OSG_RUNTIME_NUM_ASPECTS)    
00090     if(_bNumAspectSet == false && uiNumAspects > 1)
00091     {
00092 #if defined(OSG_ASPECT_USE_PTHREADSELF) || \
00093     defined(OSG_ASPECT_USE_CUSTOMSELF)
00094         UInt32  i;
00095         UInt16 *pAspect = new UInt16[uiNumAspects];
00096 
00097         for(i = 0; i < _uiNumAspects; i++)
00098             pAspect[i] = Thread::_pAspects[i];
00099 
00100         for(i = _uiNumAspects; i < uiNumAspects; i++)
00101             Thread::_pAspects[i] = 0;
00102 
00103         delete [] Thread::_pAspects;
00104 
00105         Thread::_pAspectsA = pAspect;
00106 #endif
00107         _uiNumAspects  = uiNumAspects;
00108         _bNumAspectSet = true;        
00109     }    
00110 #endif
00111 }

UInt32 ThreadManager::getNumAspects ( void   )  [static]

BaseThread * ThreadManager::getThread ( const Char8 szName,
const Char8 szTypeName = "OSGThread" 
)

Definition at line 121 of file OSGThreadManager.cpp.

References _sThreadStore, _storePLock, osg::Lock::aquire(), osg::MPFieldStore< MPFieldT >::getMPField(), and osg::Lock::release().

Referenced by osg::ExternalThread::get(), osg::Thread::get(), osg::BaseThread::get(), init(), and osg::ProxyGroup::startLoading().

00123 {
00124     BaseThread *returnValue = NULL;
00125 
00126     _storePLock->aquire();
00127 
00128     returnValue = _sThreadStore.getMPField(szName, szTypeName);
00129 
00130     _storePLock->release();
00131 
00132     return returnValue;
00133 }

Barrier * ThreadManager::getBarrier ( const Char8 szName,
const Char8 szTypeName = "OSGBarrier" 
)

Definition at line 135 of file OSGThreadManager.cpp.

References _sBarrierStore, _storePLock, osg::Lock::aquire(), osg::MPFieldStore< MPFieldT >::getMPField(), and osg::Lock::release().

Referenced by osg::Barrier::get().

00137 {
00138     Barrier *returnValue = NULL;
00139 
00140     _storePLock->aquire();
00141 
00142     returnValue = _sBarrierStore.getMPField(szName, szTypeName);
00143 
00144     _storePLock->release();
00145 
00146     return returnValue;
00147 }

Lock * ThreadManager::getLock ( const Char8 szName,
const Char8 szTypeName = "OSGLock" 
)

Definition at line 149 of file OSGThreadManager.cpp.

References _sLockStore, _storePLock, osg::Lock::aquire(), osg::MPFieldStore< MPFieldT >::getMPField(), and osg::Lock::release().

Referenced by osg::Window::GLObject::decRefCounter(), osg::Lock::get(), osg::Window::GLObject::incRefCounter(), osg::FieldContainerFactory::initialize(), and osg::Window::staticAcquire().

00151 {
00152     Lock *returnValue = NULL;
00153 
00154     _storePLock->aquire();
00155 
00156     returnValue = _sLockStore.getMPField(szName, szTypeName);
00157 
00158     _storePLock->release();
00159 
00160     return returnValue;
00161 }

LockPool * ThreadManager::getLockPool ( const Char8 szName,
const Char8 szTypeName = "OSGLockPool" 
)

Definition at line 163 of file OSGThreadManager.cpp.

References _sLockPoolStore, _storePLock, osg::Lock::aquire(), osg::MPFieldStore< MPFieldT >::getMPField(), and osg::Lock::release().

Referenced by osg::LockPool::get(), and osg::FieldContainerPtrBase::initialize().

00165 {
00166     LockPool *returnValue = NULL;
00167 
00168     _storePLock->aquire();
00169 
00170     returnValue = _sLockPoolStore.getMPField(szName, szTypeName);
00171 
00172     _storePLock->release();
00173 
00174     return returnValue;
00175 }

BaseThread * ThreadManager::findThread ( const Char8 szName  ) 

Definition at line 177 of file OSGThreadManager.cpp.

References _sThreadStore, _storePLock, osg::Lock::aquire(), osg::MPFieldStore< MPFieldT >::findMPField(), and osg::Lock::release().

Referenced by osg::ExternalThread::find(), osg::Thread::find(), and osg::BaseThread::find().

00178 {
00179     BaseThread *returnValue = NULL;
00180 
00181     _storePLock->aquire();
00182     
00183     returnValue = _sThreadStore.findMPField(szName);
00184 
00185     _storePLock->release();
00186 
00187     return returnValue;
00188 }

Barrier * ThreadManager::findBarrier ( const Char8 szName  ) 

Definition at line 190 of file OSGThreadManager.cpp.

References _sBarrierStore, _storePLock, osg::Lock::aquire(), osg::MPFieldStore< MPFieldT >::findMPField(), and osg::Lock::release().

Referenced by osg::Barrier::find().

00191 {
00192     Barrier *returnValue = NULL;
00193 
00194     _storePLock->aquire();
00195     
00196     returnValue = _sBarrierStore.findMPField(szName);
00197 
00198     _storePLock->release();
00199 
00200     return returnValue;
00201 }

Lock * ThreadManager::findLock ( const Char8 szName  ) 

Definition at line 203 of file OSGThreadManager.cpp.

References _sLockStore, _storePLock, osg::Lock::aquire(), osg::MPFieldStore< MPFieldT >::findMPField(), and osg::Lock::release().

Referenced by osg::Lock::find().

00204 {
00205     Lock *returnValue = NULL;
00206 
00207     _storePLock->aquire();
00208     
00209     returnValue = _sLockStore.findMPField(szName);
00210 
00211     _storePLock->release();
00212 
00213     return returnValue;
00214 }

LockPool * ThreadManager::findLockPool ( const Char8 szName  ) 

Definition at line 216 of file OSGThreadManager.cpp.

References _sLockPoolStore, _storePLock, osg::Lock::aquire(), osg::MPFieldStore< MPFieldT >::findMPField(), and osg::Lock::release().

Referenced by osg::LockPool::find().

00217 {
00218     LockPool *returnValue = NULL;
00219 
00220     _storePLock->aquire();
00221     
00222     returnValue = _sLockPoolStore.findMPField(szName);
00223 
00224     _storePLock->release();
00225 
00226     return returnValue;
00227 }

bool ThreadManager::initialize ( void   )  [static, protected]

Definition at line 240 of file OSGThreadManager.cpp.

References init(), and the().

Referenced by osg::osgInit().

00241 {
00242     return the()->init();
00243 }

bool ThreadManager::terminate ( void   )  [static, protected]

Definition at line 245 of file OSGThreadManager.cpp.

References shutdown(), and the().

Referenced by osg::osgExit().

00246 {
00247     return the()->shutdown();
00248 }

void ThreadManager::removeThread ( BaseThread pThread  )  [protected]

Definition at line 250 of file OSGThreadManager.cpp.

References _bShutdownInProgress, _sThreadStore, _storePLock, osg::Lock::aquire(), osg::Lock::release(), and osg::MPFieldStore< MPFieldT >::removeMPField().

Referenced by osg::BaseThread::~BaseThread().

00251 {
00252     if(_bShutdownInProgress == true)
00253         return;
00254 
00255     _storePLock->aquire();
00256 
00257     _sThreadStore.removeMPField(pThread);
00258     
00259     _storePLock->release();
00260 }

void ThreadManager::removeBarrier ( Barrier pBarrier  )  [protected]

Definition at line 262 of file OSGThreadManager.cpp.

References _bShutdownInProgress, _sBarrierStore, _storePLock, osg::Lock::aquire(), osg::Lock::release(), and osg::MPFieldStore< MPFieldT >::removeMPField().

Referenced by osg::Barrier::~Barrier().

00263 {
00264     if(_bShutdownInProgress == true)
00265         return;
00266 
00267     _storePLock->aquire();
00268 
00269     _sBarrierStore.removeMPField(pBarrier);
00270     
00271     _storePLock->release();
00272 }

void ThreadManager::removeLock ( Lock pLock  )  [protected]

Definition at line 274 of file OSGThreadManager.cpp.

References _bShutdownInProgress, _sLockStore, _storePLock, osg::Lock::aquire(), osg::Lock::release(), and osg::MPFieldStore< MPFieldT >::removeMPField().

Referenced by osg::Lock::~Lock().

00275 {
00276     if(_bShutdownInProgress == true)
00277         return;
00278 
00279     _storePLock->aquire();
00280 
00281     _sLockStore.removeMPField(pLock);
00282     
00283     _storePLock->release();
00284 }

void ThreadManager::removeLockPool ( LockPool pLockPool  )  [protected]

Definition at line 286 of file OSGThreadManager.cpp.

References _bShutdownInProgress, _sLockPoolStore, _storePLock, osg::Lock::aquire(), osg::Lock::release(), and osg::MPFieldStore< MPFieldT >::removeMPField().

Referenced by osg::LockPool::~LockPool().

00287 {
00288     if(_bShutdownInProgress == true)
00289         return;
00290 
00291     _storePLock->aquire();
00292 
00293     _sLockPoolStore.removeMPField(pLockPool);
00294     
00295     _storePLock->release();
00296 }

UInt32 ThreadManager::registerThreadType ( MPThreadType pType  )  [protected]

Definition at line 298 of file OSGThreadManager.cpp.

References _sThreadStore, and osg::MPFieldStore< MPFieldT >::registerMPType().

Referenced by osg::MPThreadType::MPThreadType().

00299 {
00300     return _sThreadStore.registerMPType(pType);
00301 }

UInt32 ThreadManager::registerBarrierType ( MPBarrierType pType  )  [protected]

Definition at line 303 of file OSGThreadManager.cpp.

References _sBarrierStore, and osg::MPFieldStore< MPFieldT >::registerMPType().

Referenced by osg::MPBarrierType::MPBarrierType().

00304 {
00305     return _sBarrierStore.registerMPType(pType);
00306 }

UInt32 ThreadManager::registerLockType ( MPLockType pType  )  [protected]

Definition at line 308 of file OSGThreadManager.cpp.

References _sLockStore, and osg::MPFieldStore< MPFieldT >::registerMPType().

Referenced by osg::MPLockType::MPLockType().

00309 {
00310     return _sLockStore.registerMPType(pType);
00311 }

UInt32 ThreadManager::registerLockPoolType ( MPLockPoolType pType  )  [protected]

Definition at line 313 of file OSGThreadManager.cpp.

References _sLockPoolStore, and osg::MPFieldStore< MPFieldT >::registerMPType().

Referenced by osg::MPLockPoolType::MPLockPoolType().

00314 {
00315     return _sLockPoolStore.registerMPType(pType);
00316 }

bool ThreadManager::init ( void   )  [protected]

Definition at line 323 of file OSGThreadManager.cpp.

References _pAppThread, _sLockStore, _storePLock, _szAppThreadType, FDEBUG, FFASSERT, FINFO, osg::Barrier::getClassType(), osg::BaseThread::getClassType(), osg::Lock::getClassType(), osg::MPFieldStore< MPFieldT >::getMPField(), getThread(), osg::BasePThreadBase::init(), SFATAL, and SINFO.

Referenced by initialize().

00324 {
00325     bool returnValue = true;
00326 
00327     FDEBUG(("OSGThreadManager init\n"))
00328 
00329 #if defined(OSG_USE_SPROC)
00330     usconfig(CONF_AUTOGROW,   1);
00331     usconfig(CONF_INITUSERS, 20);
00332     usconfig(CONF_INITSIZE, 10 * 1048576);
00333     usconfig(CONF_CHMOD, 0666);
00334 
00335     _pArena = usinit("/dev/zero");
00336 
00337     if(_pArena == NULL)
00338     {
00339         SFATAL << "OSGTM : could not initialize arena " << errno << std::endl;
00340         returnValue = false;
00341     }
00342     else
00343     {
00344         SINFO << "OSGTM : got arena " << _pArena << std::endl;
00345     }
00346 #endif
00347 
00348 #ifdef darwin
00349     Lock      ::getClassType();
00350     BaseThread::getClassType();
00351     Barrier   ::getClassType();
00352 #endif
00353 
00354     _storePLock = _sLockStore.getMPField("OSGTMStoreLock", "OSGLock");
00355     
00356     if(_storePLock == NULL)
00357     {
00358         SFATAL << "OSGTM : could not get table lock" << std::endl;
00359 
00360         returnValue = false;
00361     }
00362     else
00363     {
00364         SINFO << "OSGTM : got table lock " << _storePLock << std::endl;
00365     }
00366 
00367     if(_szAppThreadType == NULL)
00368     {
00369         FINFO(("OSGTM : create -OSGBaseThread- app thread\n"))
00370 
00371         _pAppThread = getThread("OSGAppThread", "OSGBaseThread");
00372     }
00373     else
00374     {
00375         FINFO(("OSGTM : create -%s- app thread\n", _szAppThreadType))
00376         _pAppThread = getThread("OSGAppThread", _szAppThreadType);
00377     }
00378 
00379     FFASSERT((_pAppThread != NULL), 1, 
00380              ("OSGTM : could not get application thread \n");)
00381              
00382 
00383     FINFO(("OSGTM : got application thread %p\n", _pAppThread))
00384 
00385     _pAppThread->init();
00386 
00387     return returnValue;
00388 }

bool ThreadManager::shutdown ( void   )  [protected]

Definition at line 394 of file OSGThreadManager.cpp.

References _bShutdownInProgress, _sBarrierStore, _sLockPoolStore, _sLockStore, _sThreadStore, osg::MPFieldStore< MPFieldT >::clear(), osg::PThreadBase::freeAspect(), osg::PThreadBase::freeChangeList(), and osg::BasePThreadBase::freeThread().

Referenced by terminate().

00395 {
00396     _bShutdownInProgress = true;
00397 
00398     _sThreadStore.clear();
00399     _sBarrierStore.clear();
00400     _sLockStore.clear();
00401     _sLockPoolStore.clear();
00402 
00403 #ifdef CHECK
00404 #if defined (OSG_ASPECT_USE_LOCALSTORAGE)
00405     Thread::freeAspect();
00406     Thread::freeThread();
00407     Thread::freeChangeList();
00408 #endif
00409 #endif
00410 
00411 #if defined(OSG_USE_SPROC)
00412     if(_pArena != NULL)
00413         usdetach(_pArena);
00414 #endif
00415 
00416     return true;
00417 }

void osg::ThreadManager::operator= ( const ThreadManager source  )  [private]


Friends And Related Function Documentation

friend class MPThreadType [friend]

Definition at line 266 of file OSGThreadManager.h.

friend class MPBarrierType [friend]

Definition at line 267 of file OSGThreadManager.h.

friend class MPLockType [friend]

Definition at line 268 of file OSGThreadManager.h.

friend class MPLockPoolType [friend]

Definition at line 269 of file OSGThreadManager.h.

friend class BaseThread [friend]

Definition at line 271 of file OSGThreadManager.h.

friend class Barrier [friend]

Definition at line 272 of file OSGThreadManager.h.

friend class Lock [friend]

Definition at line 273 of file OSGThreadManager.h.

friend class LockPool [friend]

Definition at line 274 of file OSGThreadManager.h.

bool osgInit ( Int32  argc,
Char8 **  argv,
UInt16  major,
UInt16  minor,
UInt16  release,
bool  debug,
bool  dll,
bool  mt 
) [friend]

Definition at line 303 of file OSGBaseFunctions.cpp.

00306 {
00307     CompileConfig prog(major, minor, release, debug, dll, mt),
00308     lib(OSG_MAJOR_VERSION, OSG_MINOR_VERSION, 
00309                       OSG_RELEASE_VERSION,
00310 #ifdef _DEBUG  
00311     true,
00312 #else
00313     false,
00314 #endif
00315 #ifdef _DLL  
00316     true,
00317 #else
00318     false,
00319 #endif
00320 #ifdef _MT  
00321     true
00322 #else
00323     false
00324 #endif
00325     );
00326     
00327     if(lib.compare(prog))
00328     {
00329         exit(1);
00330     }
00331 
00332     // without it floats could be written as "1,456" ...
00333     setlocale(LC_NUMERIC, "English");
00334     
00335     UInt32 i;
00336     bool   returnValue = true;
00337 
00338     returnValue = SharedObjectHandler::the()->initialize();
00339 
00340     if(osgPreloadSharedObject != NULL)
00341     {
00342         for(UInt32 i = 0; i < osgPreloadSharedObject->size(); ++i)
00343         {
00344             SharedObjectHandler::the()->getOSGSharedObject(
00345                 (*osgPreloadSharedObject)[i].c_str());
00346         }
00347     }
00348 
00349 #ifdef WIN32
00350     std::string pathSep(";");
00351 #else
00352     std::string pathSep(":");
00353 #endif
00354 
00355     char *szEnvLibs = getenv("OSG_LOAD_LIBS");
00356 
00357     if(szEnvLibs != NULL)
00358     {
00359         std::string tmpString(szEnvLibs);
00360         string_token_iterator libIt(tmpString, pathSep.c_str());
00361 
00362         string_token_iterator libEnd;
00363 
00364         while(libIt != libEnd)
00365         {
00366             SharedObjectHandler::the()->getOSGSharedObject(
00367                 (*libIt).c_str());
00368 
00369             ++libIt;
00370         }
00371     }
00372 
00373     const char *szEnvPlugins       = getenv("OSG_PLUGIN_PATH");
00374     const char *szEnvPluginPattern = getenv("OSG_PLUGIN_PATTERN");
00375 
00376     if(szEnvPlugins != NULL)
00377     {
00378         if(szEnvPluginPattern == NULL)
00379         {
00380             szEnvPluginPattern = PluginPattern;
00381         }
00382 
00383         FINFO(("Get Plugins %s from %s\n", 
00384                szEnvPluginPattern,
00385                szEnvPlugins));
00386 
00387         std::vector<Char8 *> *pPlugins = 
00388             Directory::getEntries(szEnvPlugins, szEnvPluginPattern);
00389 
00390         if(pPlugins != NULL)
00391         {
00392             std::string szPluginName;
00393 
00394             for(UInt32 i = 0; i < pPlugins->size(); ++i)
00395             {
00396                 if((*pPlugins)[i][0] == '.')
00397                 {
00398                     if((*pPlugins)[i][1] == '\0')
00399                     {
00400                         continue;
00401                     }
00402                     else if((*pPlugins)[i][1] == '.' &&
00403                             (*pPlugins)[i][2] == '\0')
00404                     {
00405                         continue;
00406                     }
00407                 }
00408 
00409                 szPluginName.assign(szEnvPlugins);
00410                 szPluginName += '/';
00411                 szPluginName += (*pPlugins)[i];
00412 
00413                 FINFO(("Loading plugin %s\n", 
00414                        szPluginName.c_str()));
00415 
00416                 SharedObjectHandler::the()->getSharedObject(
00417                     szPluginName.c_str());
00418             }
00419         }
00420 
00421         delete pPlugins;
00422     }
00423 
00424     SharedObjectHandler::the()->dump();
00425 
00426     if(returnValue == false)
00427         return returnValue;
00428 
00429     if(osgPreMPInitFunctions != NULL)
00430     {
00431         for(i = 0; i < osgPreMPInitFunctions->size(); i++)
00432         {
00433             returnValue &= (*osgPreMPInitFunctions)[i]();
00434             
00435             if(returnValue == false)
00436                 break;         
00437         }
00438     
00439         osgPreMPInitFunctions->clear();
00440     }
00441         
00442     if(returnValue == false)
00443         return returnValue;
00444 
00445     returnValue &= ThreadManager::initialize();
00446 
00447     if(returnValue == false)
00448         return returnValue;
00449 
00450     if(osgInitFunctions != NULL)
00451     {
00452         for(i = 0; i < osgInitFunctions->size(); i++)
00453         {
00454             returnValue &= (*osgInitFunctions)[i]();
00455             
00456             if(returnValue == false)
00457                 break;         
00458         }
00459 
00460         osgInitFunctions->clear();
00461     }
00462     
00463     if(returnValue == false)
00464         return returnValue;
00465 
00466 #ifdef OSG_GV_BETA
00467     returnValue &= FactoryController::the()->initialize();
00468 #endif
00469 
00470     GlobalSystemState = Running;
00471 
00472     atexit(osgExitWrapper);
00473     
00474     return returnValue;
00475 }

bool osgExit ( void   )  [friend]

Definition at line 480 of file OSGBaseFunctions.cpp.

00481 {
00482     bool returnValue = true;
00483 
00484     if(GlobalSystemState != Running)
00485         return true;
00486         
00487     GlobalSystemState = Shutdown;
00488 
00489 #ifdef OSG_GV_BETA
00490     returnValue &= FactoryController::the()->terminate();
00491 #endif
00492     SharedObjectHandler::the()->terminate();
00493     
00494     if(osgSystemExitFunctions != NULL)
00495     {
00496         for(Int32 i = osgSystemExitFunctions->size() - 1; i >= 0; i--)
00497         {
00498             returnValue &= (*osgSystemExitFunctions)[i]();
00499             
00500             if(returnValue == false)
00501                 break;         
00502         }
00503     }
00504 
00505     returnValue &= ThreadManager::terminate();
00506 
00507     if(osgPostMPExitFunctions != NULL)
00508     {
00509         for(Int32 i = osgPostMPExitFunctions->size() - 1; i >= 0; i--)
00510         {
00511             returnValue &= (*osgPostMPExitFunctions)[i]();
00512             
00513             if(returnValue == false)
00514                 break;         
00515         }
00516     }
00517 
00518     return returnValue;
00519 }


Member Data Documentation

ThreadManager * ThreadManager::_pThreadManager = NULL [static, private]

Definition at line 289 of file OSGThreadManager.h.

Referenced by the().

BaseThread * ThreadManager::_pAppThread = NULL [static, private]

Definition at line 290 of file OSGThreadManager.h.

Referenced by getAppThread(), and init().

bool ThreadManager::_bShutdownInProgress = false [static, private]

Definition at line 292 of file OSGThreadManager.h.

Referenced by removeBarrier(), removeLock(), removeLockPool(), removeThread(), and shutdown().

UInt32 ThreadManager::_uiNumAspects = OSG_NUM_ASPECTS [static, private]

Definition at line 294 of file OSGThreadManager.h.

Referenced by getNumAspects(), and setNumAspects().

Definition at line 305 of file OSGThreadManager.h.

Referenced by findThread(), getThread(), registerThreadType(), removeThread(), and shutdown().

Definition at line 307 of file OSGThreadManager.h.

Referenced by findLock(), getLock(), init(), registerLockType(), removeLock(), and shutdown().

Char8 * ThreadManager::_szAppThreadType = NULL [static, private]

Definition at line 312 of file OSGThreadManager.h.

Referenced by init(), and setAppThreadType().


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

Generated on Mon Mar 17 11:10:51 2008 for OpenSG by  doxygen 1.5.5