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

Method shutdown

Engine/source/platform/threads/threadPool.cpp:369–398  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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