Slotted shared mutex.
More...
#include <tkrzw_thread_util.h>
◆ SlottedMutex()
tkrzw::SlottedMutex::SlottedMutex |
( |
int32_t |
num_slots | ) |
|
|
explicit |
Constructor.
- Parameters
-
num_slots | The number of slots. |
◆ ~SlottedMutex()
tkrzw::SlottedMutex::~SlottedMutex |
( |
| ) |
|
◆ GetNumSlots()
int32_t tkrzw::SlottedMutex::GetNumSlots |
( |
| ) |
const |
Gets the number of the slots.
@ return the number of the slots.
◆ LockOne()
void tkrzw::SlottedMutex::LockOne |
( |
int32_t |
index | ) |
|
Gets exclusive ownership of a slot.
- Parameters
-
index | The index of the slot to lock. |
◆ UnlockOne()
void tkrzw::SlottedMutex::UnlockOne |
( |
int32_t |
index | ) |
|
Releases exclusive ownership of a slot.
- Parameters
-
index | The index of the slot to unlock. |
◆ LockAll()
void tkrzw::SlottedMutex::LockAll |
( |
| ) |
|
Gets exclusive ownership of all slots.
◆ UnlockAll()
void tkrzw::SlottedMutex::UnlockAll |
( |
| ) |
|
Releases exclusive ownership of all slots.
◆ LockOneShared()
void tkrzw::SlottedMutex::LockOneShared |
( |
int32_t |
index | ) |
|
Gets shared ownership of a slot.
- Parameters
-
index | The index of the slot to lock. |
◆ UnlockOneShared()
void tkrzw::SlottedMutex::UnlockOneShared |
( |
int32_t |
index | ) |
|
Releases shared ownership of a slot.
- Parameters
-
index | The index of the slot to unlock. |
◆ LockAllShared()
void tkrzw::SlottedMutex::LockAllShared |
( |
| ) |
|
Gets shared ownership of all slots.
◆ UnlockAllShared()
void tkrzw::SlottedMutex::UnlockAllShared |
( |
| ) |
|
Releases exclusive ownership of all slots.