MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / startup

Method startup

OgreMain/src/Threading/OgreDefaultWorkQueueTBB.cpp:59–98  ·  view source on GitHub ↗

---------------------------------------------------------------------

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 10

WorkerFuncFunction · 0.85
streamMethod · 0.45
initializeMethod · 0.45
getRenderSystemMethod · 0.45
insertMethod · 0.45
sizeMethod · 0.45
runMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected