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

Method queueWorkItem

Engine/source/platform/threads/threadPool.cpp:390–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

388//--------------------------------------------------------------------------
389
390void ThreadPool::queueWorkItem( WorkItem* item )
391{
392 bool executeRightAway = ( getForceAllMainThread() );
393#ifdef DEBUG_SPEW
394 Platform::outputDebugString( "[ThreadPool] %s work item '0x%x'",
395 ( executeRightAway ? "executing" : "queuing" ),
396 item );
397#endif
398
399 if( executeRightAway )
400 item->process();
401 else
402 {
403 // Put the item in the queue.
404 dFetchAndAdd( mNumPendingItems, 1 );
405 mWorkItemQueue.insert( item->getPriority(), item );
406
407 mSemaphore.release();
408 }
409}
410
411//--------------------------------------------------------------------------
412

Callers 5

ddsCompressFunction · 0.80
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