Logo ROOT  
Reference Guide
ROOT::TReentrantRWLock< MutexT, RecurseCountsT > Class Template Reference

template<typename MutexT = ROOT::TSpinMutex, typename RecurseCountsT = Internal::RecurseCounts>
class ROOT::TReentrantRWLock< MutexT, RecurseCountsT >

Definition at line 153 of file TReentrantRWLock.hxx.

Public Types

using State = TVirtualRWMutex::State
 
using StateDelta = TVirtualRWMutex::StateDelta
 

Public Member Functions

 TReentrantRWLock ()
 Regular constructor. More...
 
void Apply (std::unique_ptr< StateDelta > &&delta)
 Re-apply a delta. More...
 
std::unique_ptr< StateGetStateBefore ()
 Get the lock state before the most recent write lock was taken. More...
 
TVirtualRWMutex::Hint_t * ReadLock ()
 Acquire the lock in read mode. More...
 
void ReadUnLock (TVirtualRWMutex::Hint_t *)
 Release the lock in read mode. More...
 
std::unique_ptr< StateDeltaRewind (const State &earlierState)
 Rewind to an earlier mutex state, returning the delta. More...
 
TVirtualRWMutex::Hint_t * WriteLock ()
 Acquire the lock in write mode. More...
 
void WriteUnLock (TVirtualRWMutex::Hint_t *)
 Release the lock in write mode. More...
 

Private Member Functions

void AssertReadCountLocIsFromCurrentThread (const size_t *presumedLocalReadersCount)
 Assert that presumedLocalReadersCount really matches the local read count. More...
 

Private Attributes

std::condition_variable_any fCond
 ! RWlock internal condition variable More...
 
MutexT fMutex
 ! RWlock internal mutex More...
 
std::atomic< int > fReaderReservation
 ! A reader wants access More...
 
std::atomic< int > fReaders
 ! Number of readers More...
 
RecurseCountsT fRecurseCounts
 ! Trackers for re-entry in the lock by the same thread. More...
 
std::atomic< bool > fWriter
 ! Is there a writer? More...
 
std::atomic< int > fWriterReservation
 ! A writer wants access More...
 

#include <ROOT/TReentrantRWLock.hxx>

Member Typedef Documentation

◆ State

template<typename MutexT = ROOT::TSpinMutex, typename RecurseCountsT = Internal::RecurseCounts>
using ROOT::TReentrantRWLock< MutexT, RecurseCountsT >::State = TVirtualRWMutex::State

Definition at line 173 of file TReentrantRWLock.hxx.

◆ StateDelta

template<typename MutexT = ROOT::TSpinMutex, typename RecurseCountsT = Internal::RecurseCounts>
using ROOT::TReentrantRWLock< MutexT, RecurseCountsT >::StateDelta = TVirtualRWMutex::StateDelta

Definition at line 174 of file TReentrantRWLock.hxx.

Constructor & Destructor Documentation

◆ TReentrantRWLock()

template<typename MutexT = ROOT::TSpinMutex, typename RecurseCountsT = Internal::RecurseCounts>
ROOT::TReentrantRWLock< MutexT, RecurseCountsT >::TReentrantRWLock ( )
inline

Regular constructor.

Definition at line 178 of file TReentrantRWLock.hxx.

Member Function Documentation

◆ Apply()

template<typename MutexT , typename RecurseCountsT >
void TReentrantRWLock::Apply ( std::unique_ptr< StateDelta > &&  delta)

Re-apply a delta.

Definition at line 338 of file TReentrantRWLock.cxx.

◆ AssertReadCountLocIsFromCurrentThread()

template<typename MutexT , typename RecurseCountsT >
void TReentrantRWLock::AssertReadCountLocIsFromCurrentThread ( const size_t *  presumedLocalReadersCount)
private

Assert that presumedLocalReadersCount really matches the local read count.

Print an error message if not.

Definition at line 374 of file TReentrantRWLock.cxx.

◆ GetStateBefore()

template<typename MutexT , typename RecurseCountsT >
std::unique_ptr< TVirtualRWMutex::State > TReentrantRWLock::GetStateBefore

Get the lock state before the most recent write lock was taken.

Definition at line 252 of file TReentrantRWLock.cxx.

◆ ReadLock()

template<typename MutexT , typename RecurseCountsT >
TVirtualRWMutex::Hint_t * TReentrantRWLock::ReadLock

Acquire the lock in read mode.

Definition at line 62 of file TReentrantRWLock.cxx.

◆ ReadUnLock()

template<typename MutexT , typename RecurseCountsT >
void TReentrantRWLock::ReadUnLock ( TVirtualRWMutex::Hint_t *  hint)

Release the lock in read mode.

Definition at line 129 of file TReentrantRWLock.cxx.

◆ Rewind()

template<typename MutexT , typename RecurseCountsT >
std::unique_ptr< TVirtualRWMutex::StateDelta > TReentrantRWLock::Rewind ( const State earlierState)

Rewind to an earlier mutex state, returning the delta.

Definition at line 292 of file TReentrantRWLock.cxx.

◆ WriteLock()

template<typename MutexT , typename RecurseCountsT >
TVirtualRWMutex::Hint_t * TReentrantRWLock::WriteLock

Acquire the lock in write mode.

Definition at line 161 of file TReentrantRWLock.cxx.

◆ WriteUnLock()

template<typename MutexT , typename RecurseCountsT >
void TReentrantRWLock::WriteUnLock ( TVirtualRWMutex::Hint_t *  )

Release the lock in write mode.

Definition at line 209 of file TReentrantRWLock.cxx.

Member Data Documentation

◆ fCond

template<typename MutexT = ROOT::TSpinMutex, typename RecurseCountsT = Internal::RecurseCounts>
std::condition_variable_any ROOT::TReentrantRWLock< MutexT, RecurseCountsT >::fCond
private

! RWlock internal condition variable

Definition at line 161 of file TReentrantRWLock.hxx.

◆ fMutex

template<typename MutexT = ROOT::TSpinMutex, typename RecurseCountsT = Internal::RecurseCounts>
MutexT ROOT::TReentrantRWLock< MutexT, RecurseCountsT >::fMutex
private

! RWlock internal mutex

Definition at line 160 of file TReentrantRWLock.hxx.

◆ fReaderReservation

template<typename MutexT = ROOT::TSpinMutex, typename RecurseCountsT = Internal::RecurseCounts>
std::atomic<int> ROOT::TReentrantRWLock< MutexT, RecurseCountsT >::fReaderReservation
private

! A reader wants access

Definition at line 157 of file TReentrantRWLock.hxx.

◆ fReaders

template<typename MutexT = ROOT::TSpinMutex, typename RecurseCountsT = Internal::RecurseCounts>
std::atomic<int> ROOT::TReentrantRWLock< MutexT, RecurseCountsT >::fReaders
private

! Number of readers

Definition at line 156 of file TReentrantRWLock.hxx.

◆ fRecurseCounts

template<typename MutexT = ROOT::TSpinMutex, typename RecurseCountsT = Internal::RecurseCounts>
RecurseCountsT ROOT::TReentrantRWLock< MutexT, RecurseCountsT >::fRecurseCounts
private

! Trackers for re-entry in the lock by the same thread.

Definition at line 163 of file TReentrantRWLock.hxx.

◆ fWriter

template<typename MutexT = ROOT::TSpinMutex, typename RecurseCountsT = Internal::RecurseCounts>
std::atomic<bool> ROOT::TReentrantRWLock< MutexT, RecurseCountsT >::fWriter
private

! Is there a writer?

Definition at line 159 of file TReentrantRWLock.hxx.

◆ fWriterReservation

template<typename MutexT = ROOT::TSpinMutex, typename RecurseCountsT = Internal::RecurseCounts>
std::atomic<int> ROOT::TReentrantRWLock< MutexT, RecurseCountsT >::fWriterReservation
private

! A writer wants access

Definition at line 158 of file TReentrantRWLock.hxx.


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