Slotted shared mutex.
More...
#include <tkrzw_thread_util.h>
template<typename SHAREDMUTEX = std::shared_mutex>
class tkrzw::SlottedMutex< SHAREDMUTEX >
Slotted shared mutex.
◆ SlottedMutex() [1/2]
template<typename SHAREDMUTEX >
Constructor.
- Parameters
-
num_slots | The number of slots. |
◆ ~SlottedMutex()
template<typename SHAREDMUTEX >
◆ SlottedMutex() [2/2]
template<typename SHAREDMUTEX = std::shared_mutex>
Copy and assignment are disabled.
◆ GetNumSlots()
template<typename SHAREDMUTEX >
Gets the number of the slots.
@ return the number of the slots.
◆ LockOne()
template<typename SHAREDMUTEX >
Gets exclusive ownership of a slot.
- Parameters
-
index | The index of the slot to lock. |
◆ UnlockOne()
template<typename SHAREDMUTEX >
Releases exclusive ownership of a slot.
- Parameters
-
index | The index of the slot to unlock. |
◆ LockAll()
template<typename SHAREDMUTEX >
Gets exclusive ownership of all slots.
◆ UnlockAll()
template<typename SHAREDMUTEX >
Releases exclusive ownership of all slots.
◆ LockOneShared()
template<typename SHAREDMUTEX >
Gets shared ownership of a slot.
- Parameters
-
index | The index of the slot to lock. |
◆ UnlockOneShared()
template<typename SHAREDMUTEX >
Releases shared ownership of a slot.
- Parameters
-
index | The index of the slot to unlock. |
◆ LockAllShared()
template<typename SHAREDMUTEX >
Gets shared ownership of all slots.
◆ UnlockAllShared()
template<typename SHAREDMUTEX >
Releases exclusive ownership of all slots.