OmniSciDB  29e35f4d58
Lock_Namespace::LockMgr< MutexType, KeyType > Class Template Reference

#include <LockMgr.h>

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 40 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 56 of file LockMgr.h.

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

Referenced by Lock_Namespace::getTableMutex().

57  {
58  auto lock_key = std::make_tuple(lock_type, key);
59 
60  std::unique_lock<std::mutex> lck(aMutex_);
61  auto mit = mutexMap_.find(lock_key);
62  if (mit != mutexMap_.end()) {
63  return mit->second;
64  }
65 
66  auto tMutex = std::make_shared<MutexType>();
67  mutexMap_[lock_key] = tMutex;
68  return tMutex;
69 }
static std::mutex aMutex_
Definition: LockMgr.h:45
static std::map< std::tuple< LockType, KeyType >, std::shared_ptr< MutexType > > mutexMap_
Definition: LockMgr.h:46
+ 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 45 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 46 of file LockMgr.h.


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