NetBurner 3.5.7
PDF Version
OSSpinCrit Class Reference

RAII wrapper that spin-waits to claim a critical section. More...

#include <nbrtos.h>

Public Member Functions

 OSSpinCrit (OS_CRIT &ocrit)
 Construct the OSSpinCrit and spin until the critical section is claimed.
 
 ~OSSpinCrit ()
 Destruct the OSSpinCrit and call Leave() on the OS_CRIT object.
 

Detailed Description

RAII wrapper that spin-waits to claim a critical section.

Unlike OSCriticalSectionObj (which blocks the calling task), this class repeatedly calls EnterNoWait() on the OS_CRIT object until the section is successfully claimed. This allows the scheduler to continue running the task between attempts. On destruction, Leave() is called to release the critical section.

Note
Use this only when you expect the critical section to be held for very brief periods. For longer holds, prefer OSCriticalSectionObj.
See also
OS_CRIT::EnterNoWait(), OS_CRIT::Leave(), OSCriticalSectionObj

Constructor & Destructor Documentation

◆ OSSpinCrit()

OSSpinCrit::OSSpinCrit ( OS_CRIT & ocrit)
inline

Construct the OSSpinCrit and spin until the critical section is claimed.

Repeatedly calls EnterNoWait() on the provided OS_CRIT object until it returns OS_NO_ERR, indicating successful ownership.

Parameters
ocritReference to the OS_CRIT object to claim.

The documentation for this class was generated from the following file: