Logo ROOT   6.14/05
Reference Guide
List of all members | Public Member Functions | Private Attributes | List of all members
ROOT::TSpinMutex Class Reference

A spin mutex class which respects the STL interface for mutexes.

This class allows to acquire spin locks also in combination with templates in the STL such as std::unique_lock or std::condition_variable_any. For example: ~~~ {.cpp} ROOT::TSpinMutex m; std::condition_variable cv; bool ready = false;

void worker_thread() { // Wait until main() sends data std::unique_lock<ROOT::TSpinMutex> lk(m); cv.wait(lk, []{return ready;}); [...] ~~~ {.cpp}

Definition at line 40 of file TSpinMutex.hxx.

Public Member Functions

 TSpinMutex ()=default
 TSpinMutex (const TSpinMutex &)=delete
 ~TSpinMutex ()=default
void lock ()
TSpinMutexoperator= (const TSpinMutex &)=delete
bool try_lock ()
void unlock ()

Private Attributes

std::atomic_flag fAFlag = ATOMIC_FLAG_INIT

#include <ROOT/TSpinMutex.hxx>

Constructor & Destructor Documentation

◆ TSpinMutex() [1/2]

ROOT::TSpinMutex::TSpinMutex ( )

◆ TSpinMutex() [2/2]

ROOT::TSpinMutex::TSpinMutex ( const TSpinMutex )

◆ ~TSpinMutex()

ROOT::TSpinMutex::~TSpinMutex ( )

Member Function Documentation

◆ lock()

void ROOT::TSpinMutex::lock ( )

Definition at line 51 of file TSpinMutex.hxx.

◆ operator=()

TSpinMutex& ROOT::TSpinMutex::operator= ( const TSpinMutex )

◆ try_lock()

bool ROOT::TSpinMutex::try_lock ( )

Definition at line 53 of file TSpinMutex.hxx.

◆ unlock()

void ROOT::TSpinMutex::unlock ( )

Definition at line 52 of file TSpinMutex.hxx.

Member Data Documentation

◆ fAFlag

std::atomic_flag ROOT::TSpinMutex::fAFlag = ATOMIC_FLAG_INIT

Definition at line 43 of file TSpinMutex.hxx.

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