ROOT 6.18/05 Reference Guide |
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 41 of file TSpinMutex.hxx.
Public Member Functions | |
TSpinMutex ()=default | |
TSpinMutex (const TSpinMutex &)=delete | |
~TSpinMutex ()=default | |
void | lock () |
TSpinMutex & | operator= (const TSpinMutex &)=delete |
bool | try_lock () |
void | unlock () |
Private Attributes | |
std::atomic_flag | fAFlag = ATOMIC_FLAG_INIT |
#include <ROOT/TSpinMutex.hxx>
|
default |
|
delete |
|
default |
|
inline |
Definition at line 52 of file TSpinMutex.hxx.
|
delete |
|
inline |
Definition at line 54 of file TSpinMutex.hxx.
|
inline |
Definition at line 53 of file TSpinMutex.hxx.
|
private |
Definition at line 44 of file TSpinMutex.hxx.