OmniSciDB  a5dc49c757
 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 82 of file RWLocks.h.

Constructor & Destructor Documentation

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

Definition at line 108 of file RWLocks.h.

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

108  : cat_read_lock(cat), catalog(cat), holds_lock(false) {
109  lock_catalog(cat);
110  }
std::string cat(Ts &&...args)
read_lock< T > cat_read_lock
Definition: RWLocks.h:85
void lock_catalog(const inner_type *cat)
Definition: RWLocks.h:92

+ Here is the call graph for this function:

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

Definition at line 112 of file RWLocks.h.

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

112 { 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 92 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().

92  {
93  std::thread::id tid = std::this_thread::get_id();
94 
95  if (cat->thread_holding_sqlite_lock != tid) {
96  if (!g_multi_instance) {
97  lock = heavyai::unique_lock<std::mutex>(cat->sqliteMutex_);
98  } else {
99  dlock =
101  }
102  cat->thread_holding_sqlite_lock = tid;
103  holds_lock = true;
104  }
105  }
bool g_multi_instance
Definition: heavyai_locks.h:22
std::string cat(Ts &&...args)
std::unique_lock< T > unique_lock
heavyai::unique_lock< heavyai::DistributedSharedMutex > dlock
Definition: RWLocks.h:88
heavyai::unique_lock< std::mutex > lock
Definition: RWLocks.h:87

+ Here is the caller graph for this function:

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

Definition at line 114 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().

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

+ 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 85 of file RWLocks.h.

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

Definition at line 86 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: