esp-nimble-cpp 2.6.0
Loading...
Searching...
No Matches
NimBLEUtils::SpinGuard Class Reference

A simple spinlock guard for atomic_flag. More...

#include <NimBLEUtils.h>

Public Member Functions

 SpinGuard (std::atomic_flag &flag)
 Construct a SpinGuard and acquire the lock.
 
 ~SpinGuard ()
 Destruct a SpinGuard and release the lock.
 

Detailed Description

A simple spinlock guard for atomic_flag.

Acquires the lock on construction and releases it on destruction.

Constructor & Destructor Documentation

◆ SpinGuard()

NimBLEUtils::SpinGuard::SpinGuard ( std::atomic_flag &  flag)
explicit

Construct a SpinGuard and acquire the lock.

Parameters
[in]flagThe atomic_flag to guard.

Spins until the lock is acquired.

◆ ~SpinGuard()

NimBLEUtils::SpinGuard::~SpinGuard ( )

Destruct a SpinGuard and release the lock.

Releases the lock acquired by the constructor.