Tkrzw
Public Member Functions | List of all members
tkrzw::ScopedHashLockMulti< SHAREDMUTEX > Class Template Referencefinal

Scoped lock with multiple mutexes for a hash table. More...

#include <tkrzw_thread_util.h>

Public Member Functions

 ScopedHashLockMulti (HashMutex< SHAREDMUTEX > &mutex, std::vector< std::string_view > data_list, bool writable)
 Constructor to lock multiple buckets. More...
 
 ~ScopedHashLockMulti ()
 Destructor. More...
 
 ScopedHashLockMulti (const ScopedHashLockMulti &rhs)=delete
 Copy and assignment are disabled. More...
 
ScopedHashLockMultioperator= (const ScopedHashLockMulti &rhs)=delete
 
const std::vector< int64_t > GetBucketIndices () const
 Gets the indices of the buckets. More...
 

Detailed Description

template<typename SHAREDMUTEX = std::shared_mutex>
class tkrzw::ScopedHashLockMulti< SHAREDMUTEX >

Scoped lock with multiple mutexes for a hash table.

Constructor & Destructor Documentation

◆ ScopedHashLockMulti() [1/2]

template<typename SHAREDMUTEX >
tkrzw::ScopedHashLockMulti< SHAREDMUTEX >::ScopedHashLockMulti ( HashMutex< SHAREDMUTEX > &  mutex,
std::vector< std::string_view >  data_list,
bool  writable 
)

Constructor to lock multiple buckets.

Parameters
mutexA hash mutex.
data_listThe data list to be set in the hash table.
writableTrue for exclusive lock or false for shared lock.

◆ ~ScopedHashLockMulti()

template<typename SHAREDMUTEX >
tkrzw::ScopedHashLockMulti< SHAREDMUTEX >::~ScopedHashLockMulti

Destructor.

◆ ScopedHashLockMulti() [2/2]

template<typename SHAREDMUTEX = std::shared_mutex>
tkrzw::ScopedHashLockMulti< SHAREDMUTEX >::ScopedHashLockMulti ( const ScopedHashLockMulti< SHAREDMUTEX > &  rhs)
explicitdelete

Copy and assignment are disabled.

Member Function Documentation

◆ GetBucketIndices()

template<typename SHAREDMUTEX >
const std::vector< int64_t > tkrzw::ScopedHashLockMulti< SHAREDMUTEX >::GetBucketIndices

Gets the indices of the buckets.

Returns
The indices of the buckets which the data should belong to.