Tkrzw
|
Slotted shared mutex. More...
#include <tkrzw_thread_util.h>
Public Member Functions | |
SlottedMutex (int32_t num_slots) | |
Constructor. | |
~SlottedMutex () | |
Destructor. | |
SlottedMutex (const SlottedMutex &rhs)=delete | |
Copy and assignment are disabled. | |
SlottedMutex & | operator= (const SlottedMutex &rhs)=delete |
int32_t | GetNumSlots () const |
Gets the number of the slots. | |
void | LockOne (int32_t index) |
Gets exclusive ownership of a slot. | |
void | UnlockOne (int32_t index) |
Releases exclusive ownership of a slot. | |
void | LockAll () |
Gets exclusive ownership of all slots. | |
void | UnlockAll () |
Releases exclusive ownership of all slots. | |
void | LockOneShared (int32_t index) |
Gets shared ownership of a slot. | |
void | UnlockOneShared (int32_t index) |
Releases shared ownership of a slot. | |
void | LockAllShared () |
Gets shared ownership of all slots. | |
void | UnlockAllShared () |
Releases exclusive ownership of all slots. | |
Slotted shared mutex.
|
explicit |
Constructor.
num_slots | The number of slots. |
tkrzw::SlottedMutex< SHAREDMUTEX >::~SlottedMutex | ( | ) |
Destructor.
|
explicitdelete |
Copy and assignment are disabled.
int32_t tkrzw::SlottedMutex< SHAREDMUTEX >::GetNumSlots | ( | ) | const |
Gets the number of the slots.
@ return the number of the slots.
void tkrzw::SlottedMutex< SHAREDMUTEX >::LockOne | ( | int32_t | index | ) |
Gets exclusive ownership of a slot.
index | The index of the slot to lock. |
void tkrzw::SlottedMutex< SHAREDMUTEX >::UnlockOne | ( | int32_t | index | ) |
Releases exclusive ownership of a slot.
index | The index of the slot to unlock. |
void tkrzw::SlottedMutex< SHAREDMUTEX >::LockAll | ( | ) |
Gets exclusive ownership of all slots.
void tkrzw::SlottedMutex< SHAREDMUTEX >::UnlockAll | ( | ) |
Releases exclusive ownership of all slots.
void tkrzw::SlottedMutex< SHAREDMUTEX >::LockOneShared | ( | int32_t | index | ) |
Gets shared ownership of a slot.
index | The index of the slot to lock. |
void tkrzw::SlottedMutex< SHAREDMUTEX >::UnlockOneShared | ( | int32_t | index | ) |
Releases shared ownership of a slot.
index | The index of the slot to unlock. |
void tkrzw::SlottedMutex< SHAREDMUTEX >::LockAllShared | ( | ) |
Gets shared ownership of all slots.
void tkrzw::SlottedMutex< SHAREDMUTEX >::UnlockAllShared | ( | ) |
Releases exclusive ownership of all slots.