OmniSciDB  04ee39c94c
Lock_Namespace::LockMgr< MutexType, KeyType > Class Template Reference

#include <LockMgr.h>

+ Collaboration diagram for Lock_Namespace::LockMgr< MutexType, KeyType >:

Static Public Member Functions

static std::shared_ptr< MutexTypegetMutex (const LockType lockType, const KeyType &key)
 

Static Private Attributes

static std::mutex aMutex_
 
static std::map< std::tuple< LockType, KeyType >, std::shared_ptr< MutexType > > mutexMap_
 

Detailed Description

template<typename MutexType, typename KeyType>
class Lock_Namespace::LockMgr< MutexType, KeyType >

Definition at line 39 of file LockMgr.h.

Member Function Documentation

◆ getMutex()

template<typename MutexType , typename KeyType >
std::shared_ptr< MutexType > Lock_Namespace::LockMgr< MutexType, KeyType >::getMutex ( const LockType  lockType,
const KeyType &  key 
)
static

Definition at line 55 of file LockMgr.h.

References Lock_Namespace::getTableChunkKey(), Lock_Namespace::getTableNames(), and Lock_Namespace::parse_to_ra().

Referenced by Lock_Namespace::getTableMutex().

56  {
57  auto lock_key = std::make_tuple(lock_type, key);
58 
59  std::unique_lock<std::mutex> lck(aMutex_);
60  auto mit = mutexMap_.find(lock_key);
61  if (mit != mutexMap_.end()) {
62  return mit->second;
63  }
64 
65  auto tMutex = std::make_shared<MutexType>();
66  mutexMap_[lock_key] = tMutex;
67  return tMutex;
68 }
static std::mutex aMutex_
Definition: LockMgr.h:44
static std::map< std::tuple< LockType, KeyType >, std::shared_ptr< MutexType > > mutexMap_
Definition: LockMgr.h:45
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ aMutex_

template<typename MutexType , typename KeyType >
std::mutex Lock_Namespace::LockMgr< MutexType, KeyType >::aMutex_
staticprivate

Definition at line 44 of file LockMgr.h.

◆ mutexMap_

template<typename MutexType , typename KeyType >
std::map< std::tuple< LockType, KeyType >, std::shared_ptr< MutexType > > Lock_Namespace::LockMgr< MutexType, KeyType >::mutexMap_
staticprivate

Definition at line 45 of file LockMgr.h.


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