MCPcopy Create free account
hub / github.com/carbonengine/trinity / WorkerThread

Method WorkerThread

shadercompiler/WorkQueue.h:243–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241 }
242
243 void WorkerThread()
244 {
245#if CCP_TELEMETRY_ENABLED
246 tracy::SetThreadName( "Compile Worker Thread" );
247#endif
248
249 {
250 std::unique_lock scope( m_startMutex );
251 m_waitToStart.wait( scope, [this] { return started; } );
252 }
253
254 AquireSemaphore();
255
256 while( true )
257 {
258 T* item = nullptr;
259 {
260 std::unique_lock scope( m_queueMutex );
261 if( m_queue.empty() )
262 {
263 break;
264 }
265 item = m_queue.front();
266 m_queue.pop();
267 }
268
269 if( !m_processor( *item, this ) )
270 {
271 // some terrible failure?
272 delete item;
273 break;
274 }
275 delete item;
276 }
277
278 FreeSemaphore();
279 }
280
281 Processor m_processor;
282 std::queue<T*> m_queue;

Callers

nothing calls this directly

Calls 2

waitMethod · 0.80
emptyMethod · 0.80

Tested by

no test coverage detected