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

#include <RWLocks.h>

Public Member Functions

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

Private Member Functions

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

Private Attributes

read_lock< T > cat_read_lock
 
const T * catalog
 
heavyai::unique_lock< std::mutex > lock
 
heavyai::unique_lock
< heavyai::DistributedSharedMutex
dlock
 
bool holds_lock
 

Detailed Description

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

Definition at line 79 of file RWLocks.h.

Constructor & Destructor Documentation

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

Definition at line 105 of file RWLocks.h.

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

105  : cat_read_lock(cat), catalog(cat), holds_lock(false) {
106  lock_catalog(cat);
107  }
std::string cat(Ts &&...args)
read_lock< T > cat_read_lock
Definition: RWLocks.h:82
void lock_catalog(const inner_type *cat)
Definition: RWLocks.h:89

+ Here is the call graph for this function:

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

Definition at line 109 of file RWLocks.h.

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

109 { unlock(); }

+ Here is the call graph for this function:

Member Function Documentation

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

Definition at line 89 of file RWLocks.h.

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

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

89  {
90  std::thread::id tid = std::this_thread::get_id();
91 
92  if (cat->thread_holding_sqlite_lock != tid) {
93  if (!g_multi_instance) {
94  lock = heavyai::unique_lock<std::mutex>(cat->sqliteMutex_);
95  } else {
96  dlock =
98  }
99  cat->thread_holding_sqlite_lock = tid;
100  holds_lock = true;
101  }
102  }
bool g_multi_instance
Definition: heavyai_locks.h:21
std::string cat(Ts &&...args)
std::unique_lock< T > unique_lock
heavyai::unique_lock< heavyai::DistributedSharedMutex > dlock
Definition: RWLocks.h:85
heavyai::unique_lock< std::mutex > lock
Definition: RWLocks.h:84

+ Here is the caller graph for this function:

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

Definition at line 111 of file RWLocks.h.

References Catalog_Namespace::sqlite_lock< T >::catalog, Catalog_Namespace::sqlite_lock< T >::dlock, g_multi_instance, Catalog_Namespace::sqlite_lock< T >::holds_lock, Catalog_Namespace::sqlite_lock< T >::lock, and Catalog_Namespace::read_lock< T >::unlock().

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

111  {
112  if (holds_lock) {
113  std::thread::id no_thread;
114  catalog->thread_holding_sqlite_lock = no_thread;
115  if (!g_multi_instance) {
116  lock.unlock();
117  } else {
118  dlock.unlock();
119  }
120  cat_read_lock.unlock();
121  holds_lock = false;
122  }
123  }
bool g_multi_instance
Definition: heavyai_locks.h:21
read_lock< T > cat_read_lock
Definition: RWLocks.h:82
heavyai::unique_lock< heavyai::DistributedSharedMutex > dlock
Definition: RWLocks.h:85
heavyai::unique_lock< std::mutex > lock
Definition: RWLocks.h:84

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

template<typename T >
read_lock<T> Catalog_Namespace::sqlite_lock< T >::cat_read_lock
private

Definition at line 82 of file RWLocks.h.

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

Definition at line 83 of file RWLocks.h.

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

template<typename T >
bool Catalog_Namespace::sqlite_lock< T >::holds_lock
private
template<typename T >
heavyai::unique_lock<std::mutex> Catalog_Namespace::sqlite_lock< T >::lock
private

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