MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / shutdown

Method shutdown

Engine/source/platform/threads/threadPool.cpp:357–386  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

355//--------------------------------------------------------------------------
356
357void ThreadPool::shutdown()
358{
359 const U32 numThreads = mNumThreads;
360
361 // Tell our worker threads to stop.
362
363 for( WorkerThread* thread = mThreads; thread != 0; thread = thread->getNext() )
364 thread->stop();
365
366 // Release the semaphore as many times as there are threads.
367 // Doing this separately guarantees we're not waking a thread
368 // that hasn't been set its stop flag yet.
369
370 for( U32 n = 0; n < numThreads; ++ n )
371 mSemaphore.release();
372
373 // Delete each worker thread. Wait until death as we're prone to
374 // running into issues with decomposing work item lists otherwise.
375
376 for( WorkerThread* thread = mThreads; thread != 0; )
377 {
378 WorkerThread* next = thread->getNext();
379 thread->join();
380 delete thread;
381 thread = next;
382 }
383
384 mThreads = NULL;
385 mNumThreads = 0;
386}
387
388//--------------------------------------------------------------------------
389

Callers

nothing calls this directly

Calls 4

getNextMethod · 0.45
stopMethod · 0.45
releaseMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected