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

Method flushWorkItems

Engine/source/platform/threads/threadPool.cpp:413–433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

411//--------------------------------------------------------------------------
412
413void ThreadPool::flushWorkItems( S32 timeOut )
414{
415 AssertFatal( mNumThreads, "ThreadPool::flushWorkItems() - no worker threads in pool" );
416
417 U32 endTime = 0;
418 if( timeOut != -1 )
419 endTime = Platform::getRealMilliseconds() + timeOut;
420
421 // Spinlock until the queue is empty.
422
423 while( !mWorkItemQueue.isEmpty() )
424 {
425 Platform::sleep( 25 );
426
427 // Stop if we have exceeded our processing time budget.
428
429 if( timeOut != -1
430 && Platform::getRealMilliseconds() >= endTime )
431 break;
432 }
433}
434
435void ThreadPool::waitForAllItems( S32 timeOut )
436{

Callers 2

_onTextureEventMethod · 0.80
_releaseAllResourcesMethod · 0.80

Calls 1

isEmptyMethod · 0.45

Tested by

no test coverage detected