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

Method queueWorkItem

Engine/source/platform/threads/threadPool.cpp:402–421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

400//--------------------------------------------------------------------------
401
402void ThreadPool::queueWorkItem( WorkItem* item )
403{
404 bool executeRightAway = ( getForceAllMainThread() );
405#ifdef DEBUG_SPEW
406 Platform::outputDebugString( "[ThreadPool] %s work item '0x%x'",
407 ( executeRightAway ? "executing" : "queuing" ),
408 item );
409#endif
410
411 if( executeRightAway )
412 item->process();
413 else
414 {
415 // Put the item in the queue.
416 dFetchAndAdd( mNumPendingItems, 1 );
417 mWorkItemQueue.insert( item->getPriority(), item );
418
419 mSemaphore.release();
420 }
421}
422
423//--------------------------------------------------------------------------
424

Callers 4

queueLookupMethod · 0.80
_requestNextMethod · 0.80
_requestNextMethod · 0.80
TEST_FIXFunction · 0.80

Calls 5

dFetchAndAddFunction · 0.50
processMethod · 0.45
insertMethod · 0.45
getPriorityMethod · 0.45
releaseMethod · 0.45

Tested by 1

TEST_FIXFunction · 0.64