OmniSciDB  471d68cefb
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
lockmgr::MutexTracker Class Reference

#include <LockMgrImpl.h>

Public Member Functions

 MutexTracker ()
 
MutexTypeBaseacquire ()
 
void release ()
 
bool isAcquired () const
 

Private Attributes

std::atomic< size_t > ref_count_
 
MutexTypeBase mutex_
 

Detailed Description

Definition at line 36 of file LockMgrImpl.h.

Constructor & Destructor Documentation

lockmgr::MutexTracker::MutexTracker ( )
inline

Definition at line 38 of file LockMgrImpl.h.

38 : ref_count_(0u) {}
std::atomic< size_t > ref_count_
Definition: LockMgrImpl.h:53

Member Function Documentation

MutexTypeBase& lockmgr::MutexTracker::acquire ( )
inline

Definition at line 40 of file LockMgrImpl.h.

References mutex_, and ref_count_.

40  {
41  ref_count_.fetch_add(1u);
42  return mutex_;
43  }
MutexTypeBase mutex_
Definition: LockMgrImpl.h:54
std::atomic< size_t > ref_count_
Definition: LockMgrImpl.h:53
bool lockmgr::MutexTracker::isAcquired ( ) const
inline

Definition at line 50 of file LockMgrImpl.h.

References ref_count_.

50 { return ref_count_.load() > 0; }
std::atomic< size_t > ref_count_
Definition: LockMgrImpl.h:53
void lockmgr::MutexTracker::release ( )
inline

Definition at line 45 of file LockMgrImpl.h.

References CHECK_GE, and ref_count_.

Referenced by lockmgr::TrackedRefLock< LOCK >::~TrackedRefLock().

45  {
46  const auto stored_ref_count = ref_count_.fetch_sub(1u);
47  CHECK_GE(stored_ref_count, size_t(1));
48  }
#define CHECK_GE(x, y)
Definition: Logger.h:222
std::atomic< size_t > ref_count_
Definition: LockMgrImpl.h:53

+ Here is the caller graph for this function:

Member Data Documentation

MutexTypeBase lockmgr::MutexTracker::mutex_
private

Definition at line 54 of file LockMgrImpl.h.

Referenced by acquire().

std::atomic<size_t> lockmgr::MutexTracker::ref_count_
private

Definition at line 53 of file LockMgrImpl.h.

Referenced by acquire(), isAcquired(), and release().


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