Tkrzw
|
Scoped lock with a mutex for a hash table. More...
#include <tkrzw_thread_util.h>
Public Member Functions | |
ScopedHashLock (HashMutex< SHAREDMUTEX > &mutex, std::string_view data, bool writable) | |
Constructor to lock one bucket. More... | |
ScopedHashLock (HashMutex< SHAREDMUTEX > &mutex, bool writable) | |
Constructro to lock all buckets. More... | |
ScopedHashLock (HashMutex< SHAREDMUTEX > &mutex, int64_t bucket_index, bool writable) | |
Constructor to lock the bucket specific to an index. More... | |
~ScopedHashLock () | |
Destructor. More... | |
ScopedHashLock (const ScopedHashLock &rhs)=delete | |
Copy and assignment are disabled. More... | |
ScopedHashLock & | operator= (const ScopedHashLock &rhs)=delete |
int64_t | GetBucketIndex () const |
Gets the index of the bucket. More... | |
Scoped lock with a mutex for a hash table.
tkrzw::ScopedHashLock< SHAREDMUTEX >::ScopedHashLock | ( | HashMutex< SHAREDMUTEX > & | mutex, |
std::string_view | data, | ||
bool | writable | ||
) |
Constructor to lock one bucket.
mutex | A hash mutex. |
data | The data to be set in the hash table. |
writable | True for exclusive lock or false for shared lock. |
tkrzw::ScopedHashLock< SHAREDMUTEX >::ScopedHashLock | ( | HashMutex< SHAREDMUTEX > & | mutex, |
bool | writable | ||
) |
Constructro to lock all buckets.
mutex | A hash mutex. |
writable | True for exclusive lock or false for shared lock. |
tkrzw::ScopedHashLock< SHAREDMUTEX >::ScopedHashLock | ( | HashMutex< SHAREDMUTEX > & | mutex, |
int64_t | bucket_index, | ||
bool | writable | ||
) |
Constructor to lock the bucket specific to an index.
mutex | A hash mutex. |
bucket_index | The index of the bucket to lock. |
writable | True for exclusive lock or false for shared lock. |
Only this constructor can fail. It is because of rehashing.
tkrzw::ScopedHashLock< SHAREDMUTEX >::~ScopedHashLock |
Destructor.
|
explicitdelete |
Copy and assignment are disabled.
int64_t tkrzw::ScopedHashLock< SHAREDMUTEX >::GetBucketIndex |
Gets the index of the bucket.