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

Method tryPopFront

Engine/source/platform/threads/threadSafeDeque.h:406–437  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

404
405template< typename T >
406bool ThreadSafeDeque< T >::tryPopFront( ValueType& outValue )
407{
408 NodeRef oldHead;
409
410 while( 1 )
411 {
412 oldHead = getHead();
413 if( !oldHead )
414 return false;
415
416 // Try to claim the node.
417
418 if( oldHead->mPrev.trySetFromTo( NULL, NULL, NodeRef::TAG_SetOrFail ) )
419 {
420 if( dCompareAndSwap( oldHead->mIsClaimed, 0, 1 ) )
421 break;
422 else
423 continue;
424 }
425 }
426
427 outValue = oldHead->mValue;
428 oldHead = NULL;
429
430 // Cleanup.
431 getHead();
432
433#ifdef TORQUE_DEBUG
434 dFetchAndAdd( mNumValues, -1 );
435#endif
436 return true;
437}
438
439template< typename T >
440bool ThreadSafeDeque< T >::tryPopBack( ValueType& outValue )

Callers 8

getProcessedBitmapMethod · 0.45
processMethod · 0.45
~OggTheoraDecoderMethod · 0.45
readMethod · 0.45
PurgeDeadBuffersFunction · 0.45
readMethod · 0.45
processMethod · 0.45

Calls 3

trySetFromToMethod · 0.80
dCompareAndSwapFunction · 0.50
dFetchAndAddFunction · 0.50

Tested by

no test coverage detected