Games Task Scheduler (GTS)
A multi-processor scheduling framework for games engines
gts::Backoff< GROWTH_RATE, YIELD > Class Template Reference

An object that backs-off a thread to reduce contention with other threads. More...

#include <Backoff.h>

Public Member Functions

GTS_INLINE bool tick ()
 Take the next backoff step.
 
GTS_INLINE void reset ()
 Reset the backoff state.
 
GTS_INLINE int32_t spinCount () const
 Get the number of spins to perform next tick. More...
 

Detailed Description

template<BackoffGrowth GROWTH_RATE = BackoffGrowth::Geometric, bool YIELD = true>
class gts::Backoff< GROWTH_RATE, YIELD >

An object that backs-off a thread to reduce contention with other threads.

Template Parameters
GROWTH_RATEThe growth rate of the backoff.
YIELDA flag to indicate that the backoff will yield the thread once a threshold has been reached.

Member Function Documentation

◆ spinCount()

template<BackoffGrowth GROWTH_RATE = BackoffGrowth::Geometric, bool YIELD = true>
GTS_INLINE int32_t gts::Backoff< GROWTH_RATE, YIELD >::spinCount ( ) const
inline

Get the number of spins to perform next tick.

Returns
The spin count.