OmniSciDB  95562058bd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
lockmgr::TableLockMgrImpl< T > Class Template Reference

#include <LockMgrImpl.h>

Public Member Functions

MutexTypegetTableMutex (const ChunkKey table_key)
 
std::set< ChunkKeygetLockedTables () const
 

Static Public Member Functions

static WriteLock getWriteLockForTable (const Catalog_Namespace::Catalog &cat, const std::string &table_name)
 
static WriteLock getWriteLockForTable (const ChunkKey table_key)
 
static ReadLock getReadLockForTable (const Catalog_Namespace::Catalog &cat, const std::string &table_name)
 
static ReadLock getReadLockForTable (const ChunkKey table_key)
 

Protected Member Functions

 TableLockMgrImpl ()
 

Protected Attributes

std::mutex map_mutex_
 
std::map< ChunkKey,
std::unique_ptr< MutexType > > 
table_mutex_map_
 

Detailed Description

template<class T>
class lockmgr::TableLockMgrImpl< T >

Definition at line 130 of file LockMgrImpl.h.

Constructor & Destructor Documentation

template<class T>
lockmgr::TableLockMgrImpl< T >::TableLockMgrImpl ( )
inlineprotected

Definition at line 174 of file LockMgrImpl.h.

174 {}

Member Function Documentation

template<class T>
std::set<ChunkKey> lockmgr::TableLockMgrImpl< T >::getLockedTables ( ) const
inline

Definition at line 143 of file LockMgrImpl.h.

143  {
144  std::set<ChunkKey> ret;
145  std::lock_guard<std::mutex> access_map_lock(map_mutex_);
146  for (const auto& kv : table_mutex_map_) {
147  if (kv.second->isAcquired()) {
148  ret.insert(kv.first);
149  }
150  }
151 
152  return ret;
153  }
std::map< ChunkKey, std::unique_ptr< MutexType > > table_mutex_map_
Definition: LockMgrImpl.h:177
template<class T>
static ReadLock lockmgr::TableLockMgrImpl< T >::getReadLockForTable ( const Catalog_Namespace::Catalog cat,
const std::string &  table_name 
)
inlinestatic

Definition at line 164 of file LockMgrImpl.h.

165  {
166  return helpers::getLockForTableImpl<ReadLock, T>(cat, table_name);
167  }
std::string cat(Ts &&...args)
template<class T>
static ReadLock lockmgr::TableLockMgrImpl< T >::getReadLockForTable ( const ChunkKey  table_key)
inlinestatic

Definition at line 168 of file LockMgrImpl.h.

168  {
169  auto& table_lock_mgr = T::instance();
170  return ReadLock(table_lock_mgr.getTableMutex(table_key));
171  }
TrackedRefLock< ReadLockBase > ReadLock
Definition: LockMgrImpl.h:86
template<class T>
MutexType* lockmgr::TableLockMgrImpl< T >::getTableMutex ( const ChunkKey  table_key)
inline

Definition at line 132 of file LockMgrImpl.h.

132  {
133  std::lock_guard<std::mutex> access_map_lock(map_mutex_);
134  auto mutex_it = table_mutex_map_.find(table_key);
135  if (mutex_it == table_mutex_map_.end()) {
136  table_mutex_map_.insert(std::make_pair(table_key, std::make_unique<MutexType>()));
137  } else {
138  return mutex_it->second.get();
139  }
140  return table_mutex_map_[table_key].get();
141  }
std::map< ChunkKey, std::unique_ptr< MutexType > > table_mutex_map_
Definition: LockMgrImpl.h:177
template<class T>
static WriteLock lockmgr::TableLockMgrImpl< T >::getWriteLockForTable ( const Catalog_Namespace::Catalog cat,
const std::string &  table_name 
)
inlinestatic

Definition at line 155 of file LockMgrImpl.h.

156  {
157  return helpers::getLockForTableImpl<WriteLock, T>(cat, table_name);
158  }
std::string cat(Ts &&...args)
template<class T>
static WriteLock lockmgr::TableLockMgrImpl< T >::getWriteLockForTable ( const ChunkKey  table_key)
inlinestatic

Definition at line 159 of file LockMgrImpl.h.

159  {
160  auto& table_lock_mgr = T::instance();
161  return WriteLock(table_lock_mgr.getTableMutex(table_key));
162  }
TrackedRefLock< WriteLockBase > WriteLock
Definition: LockMgrImpl.h:85

Member Data Documentation

template<class T>
std::mutex lockmgr::TableLockMgrImpl< T >::map_mutex_
mutableprotected
template<class T>
std::map<ChunkKey, std::unique_ptr<MutexType> > lockmgr::TableLockMgrImpl< T >::table_mutex_map_
protected

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