OmniSciDB  c0231cc57d
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Catalog_Namespace::write_lock< T > Class Template Reference

#include <RWLocks.h>

Public Member Functions

 write_lock (const T *cat)
 
 ~write_lock ()
 
void unlock ()
 

Private Member Functions

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

Private Attributes

const T * catalog
 
heavyai::unique_lock
< heavyai::shared_mutex
lock
 
heavyai::unique_lock
< heavyai::DistributedSharedMutex
dlock
 
bool holds_lock
 

Detailed Description

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

Definition at line 127 of file RWLocks.h.

Constructor & Destructor Documentation

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

Definition at line 150 of file RWLocks.h.

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

150 : catalog(cat), holds_lock(false) { lock_catalog(cat); }
std::string cat(Ts &&...args)
void lock_catalog(const inner_type *cat)
Definition: RWLocks.h:134

+ Here is the call graph for this function:

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

Definition at line 152 of file RWLocks.h.

References Catalog_Namespace::write_lock< T >::unlock().

152 { unlock(); }

+ Here is the call graph for this function:

Member Function Documentation

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

Definition at line 134 of file RWLocks.h.

References Catalog_Namespace::write_lock< T >::dlock, g_multi_instance, Catalog_Namespace::write_lock< T >::holds_lock, and Catalog_Namespace::write_lock< T >::lock.

Referenced by Catalog_Namespace::write_lock< T >::write_lock().

134  {
135  std::thread::id tid = std::this_thread::get_id();
136 
137  if (cat->thread_holding_write_lock != tid) {
138  if (!g_multi_instance) {
140  } else {
141  dlock =
143  }
144  cat->thread_holding_write_lock = tid;
145  holds_lock = true;
146  }
147  }
bool g_multi_instance
Definition: heavyai_locks.h:21
std::string cat(Ts &&...args)
heavyai::unique_lock< heavyai::DistributedSharedMutex > dlock
Definition: RWLocks.h:130
std::unique_lock< T > unique_lock
heavyai::unique_lock< heavyai::shared_mutex > lock
Definition: RWLocks.h:129

+ Here is the caller graph for this function:

template<typename T >
void Catalog_Namespace::write_lock< T >::unlock ( )
inline

Definition at line 154 of file RWLocks.h.

References Catalog_Namespace::write_lock< T >::catalog, Catalog_Namespace::write_lock< T >::dlock, g_multi_instance, Catalog_Namespace::write_lock< T >::holds_lock, and Catalog_Namespace::write_lock< T >::lock.

Referenced by Catalog_Namespace::Catalog::createDashboard(), Catalog_Namespace::Catalog::replaceDashboard(), Catalog_Namespace::Catalog::setUncappedTableEpoch(), and Catalog_Namespace::write_lock< T >::~write_lock().

154  {
155  if (holds_lock) {
156  std::thread::id no_thread;
157  catalog->thread_holding_write_lock = no_thread;
158  if (!g_multi_instance) {
159  lock.unlock();
160  } else {
161  dlock.unlock();
162  }
163  holds_lock = false;
164  }
165  }
bool g_multi_instance
Definition: heavyai_locks.h:21
heavyai::unique_lock< heavyai::DistributedSharedMutex > dlock
Definition: RWLocks.h:130
heavyai::unique_lock< heavyai::shared_mutex > lock
Definition: RWLocks.h:129

+ Here is the caller graph for this function:

Member Data Documentation

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

Definition at line 128 of file RWLocks.h.

Referenced by Catalog_Namespace::write_lock< T >::unlock().

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

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