CpuYield Class Reference

#include <cpuyield.h>

Inheritance diagram for CpuYield:

Public Member Functions

 CpuYield ()
 
void Reset ()
 
void Pause (const void *res=nullptr)
 

Static Public Member Functions

static void Wait (Int cnt)
 

Static Private Member Functions

static void _mm_pause ()
 

Additional Inherited Members

- Protected Types inherited from CpuYieldState
using SwitchDelegate = void(*)(CpuYieldState *state, const void *resource)
 
- Protected Attributes inherited from CpuYieldState
Int _count
 
Int _loopSize
 
- Static Protected Attributes inherited from CpuYieldState
static const Int LOOPS_START_COUNT
 
static const Int LOOPS_MAX_GRANULARITY
 
static const Int LOOPS_BEFORE_YIELD
 
static const Int LOOPS_BEFORE_SLEEP
 
static const UInt LOCK_ACQUIRE
 
static const UInt LOCK_SPIN
 
static const UInt LOCK_RELEASE
 
static const UInt MAX_STATE_ENUM
 

Constructor & Destructor Documentation

◆ CpuYield()

CpuYield ( )

Member Function Documentation

◆ Reset()

void Reset ( void  )

◆ Pause()

void Pause ( const void *  res = nullptr)

Pauses a little while until the contended resource hopefully becomes available again. Depending on the number of calls this will either just do a light spin loop or it might put the thread to sleep. Furthermore offending threads might be logged to diagnose deadlocks or bad performance.

Parameters
[in]resThe contended resource because of which Pause has to be called. Might be a nullptr.

◆ Wait()

static void Wait ( Int  cnt)
static

◆ _mm_pause()

static void _mm_pause ( )
staticprivate