12 #ifndef ROOT_TSpinMutex 13 #define ROOT_TSpinMutex 43 std::atomic_flag
fAFlag = ATOMIC_FLAG_INIT;
51 void lock() {
while (fAFlag.test_and_set(std::memory_order_acquire)); }
52 void unlock() { fAFlag.clear(std::memory_order_release); }
53 bool try_lock() {
return !fAFlag.test_and_set(std::memory_order_acquire); }
TSpinMutex & operator=(const TSpinMutex &)=delete
Namespace for new ROOT classes and functions.
A spin mutex class which respects the STL interface for mutexes.