---------------------------------------------------------------------
| 57 | } |
| 58 | //--------------------------------------------------------------------- |
| 59 | void DefaultWorkQueue::startup( bool forceRestart ) |
| 60 | { |
| 61 | if( mIsRunning ) |
| 62 | { |
| 63 | if( forceRestart ) |
| 64 | shutdown(); |
| 65 | else |
| 66 | return; |
| 67 | } |
| 68 | |
| 69 | mShuttingDown = false; |
| 70 | |
| 71 | mWorkerFunc = OGRE_NEW_T( WorkerFunc( this ), MEMCATEGORY_GENERAL ); |
| 72 | |
| 73 | LogManager::getSingleton().stream() << "DefaultWorkQueue('" << mName << "') initialising."; |
| 74 | |
| 75 | #if OGRE_NO_TBB_SCHEDULER == 0 |
| 76 | mTaskScheduler.initialize( mWorkerThreadCount ); |
| 77 | #endif |
| 78 | |
| 79 | if( mWorkerRenderSystemAccess ) |
| 80 | { |
| 81 | Root::getSingleton().getRenderSystem()->preExtraThreadsStarted(); |
| 82 | RegisterRSWorker worker( this ); |
| 83 | // current thread need not be registered |
| 84 | mRegisteredThreads.insert( tbb::this_tbb_thread::get_id() ); |
| 85 | while( mRegisteredThreads.size() < mWorkerThreadCount ) |
| 86 | { |
| 87 | // spawn tasks until all worker threads have registered themselves with the RS |
| 88 | for( size_t i = 0; i < mWorkerThreadCount * 3; ++i ) |
| 89 | { |
| 90 | mTaskGroup.run( worker ); |
| 91 | } |
| 92 | mTaskGroup.wait(); |
| 93 | } |
| 94 | Root::getSingleton().getRenderSystem()->postExtraThreadsStarted(); |
| 95 | } |
| 96 | |
| 97 | mIsRunning = true; |
| 98 | } |
| 99 | //--------------------------------------------------------------------- |
| 100 | void DefaultWorkQueue::_registerThreadWithRenderSystem() |
| 101 | { |
nothing calls this directly
no test coverage detected