OmniSciDB  c07336695a
Catalog_Namespace::write_lock< T > Class Template Reference

#include <RWLocks.h>

Public Member Functions

 write_lock (const T *cat)
 
 ~write_lock ()
 

Private Member Functions

template<typename inner_type >
void lock_catalog (const inner_type *cat)
 

Private Attributes

const T * catalog
 
mapd_unique_lock< mapd_shared_mutexlock
 
bool holds_lock
 

Detailed Description

template<typename T>
class Catalog_Namespace::write_lock< T >

Definition at line 97 of file RWLocks.h.

Constructor & Destructor Documentation

◆ write_lock()

template<typename T >
Catalog_Namespace::write_lock< T >::write_lock ( const T *  cat)
inline

Definition at line 114 of file RWLocks.h.

References Catalog_Namespace::read_lock< T >::lock_catalog().

114 : catalog(cat), holds_lock(false) { lock_catalog(cat); }
void lock_catalog(const inner_type *cat)
Definition: RWLocks.h:103
+ Here is the call graph for this function:

◆ ~write_lock()

template<typename T >
Catalog_Namespace::write_lock< T >::~write_lock ( )
inline

Definition at line 116 of file RWLocks.h.

116  {
117  if (holds_lock) {
118  std::thread::id no_thread;
119  catalog->thread_holding_write_lock = no_thread;
120  }
121  }

Member Function Documentation

◆ lock_catalog()

template<typename T >
template<typename inner_type >
void Catalog_Namespace::write_lock< T >::lock_catalog ( const inner_type *  cat)
inlineprivate

Definition at line 103 of file RWLocks.h.

103  {
104  std::thread::id tid = std::this_thread::get_id();
105 
106  if (cat->thread_holding_write_lock != tid) {
107  lock = mapd_unique_lock<mapd_shared_mutex>(cat->sharedMutex_);
108  cat->thread_holding_write_lock = tid;
109  holds_lock = true;
110  }
111  }
mapd_unique_lock< mapd_shared_mutex > lock
Definition: RWLocks.h:99

Member Data Documentation

◆ catalog

template<typename T >
const T* Catalog_Namespace::write_lock< T >::catalog
private

Definition at line 98 of file RWLocks.h.

◆ holds_lock

template<typename T >
bool Catalog_Namespace::write_lock< T >::holds_lock
private

Definition at line 100 of file RWLocks.h.

◆ lock

template<typename T >
mapd_unique_lock<mapd_shared_mutex> Catalog_Namespace::write_lock< T >::lock
private

Definition at line 99 of file RWLocks.h.


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