Tkrzw
|
Spin lock shared mutex, with write-preferring policy. More...
#include <tkrzw_thread_util.h>
Public Member Functions | |
SpinWPSharedMutex () | |
Constructor. More... | |
SpinWPSharedMutex (const SpinWPSharedMutex &rhs)=delete | |
Copy and assignment are disabled. More... | |
SpinWPSharedMutex & | operator= (const SpinWPSharedMutex &rhs)=delete |
void | lock () |
Gets exclusive ownership of the lock. More... | |
bool | try_lock () |
Tries to get exclusive ownership of the lock. More... | |
void | unlock () |
Releases exclusive ownership of the lock. More... | |
void | lock_shared () |
Gets shared ownership of the lock. More... | |
bool | try_lock_shared () |
Tries to get shared ownership of the lock. More... | |
void | unlock_shared () |
Releases shared ownership of the lock. More... | |
bool | try_upgrade (bool wait=false) |
Tries to upgrade shared ownership to exclusive ownership. More... | |
void | downgrade () |
Downgrades exclusive ownership.to shared ownership. More... | |
Spin lock shared mutex, with write-preferring policy.
tkrzw::SpinWPSharedMutex::SpinWPSharedMutex | ( | ) |
Constructor.
|
explicitdelete |
Copy and assignment are disabled.
void tkrzw::SpinWPSharedMutex::lock | ( | ) |
Gets exclusive ownership of the lock.
Precondition: The thread doesn't have any ownership.
bool tkrzw::SpinWPSharedMutex::try_lock | ( | ) |
Tries to get exclusive ownership of the lock.
Precondition: The thread doesn't have any ownership.
void tkrzw::SpinWPSharedMutex::unlock | ( | ) |
Releases exclusive ownership of the lock.
Precondition: The thread has the exclusive ownership.
void tkrzw::SpinWPSharedMutex::lock_shared | ( | ) |
Gets shared ownership of the lock.
Precondition: The thread doesn't have any ownership.
bool tkrzw::SpinWPSharedMutex::try_lock_shared | ( | ) |
Tries to get shared ownership of the lock.
Precondition: The thread doesn't have any ownership.
void tkrzw::SpinWPSharedMutex::unlock_shared | ( | ) |
Releases shared ownership of the lock.
Precondition: The thread has the shared ownership.
bool tkrzw::SpinWPSharedMutex::try_upgrade | ( | bool | wait = false | ) |
Tries to upgrade shared ownership to exclusive ownership.
wait | If true, waits while there's possibility to get exclusive ownership. |
Precondition: The thread has the shared ownership.
void tkrzw::SpinWPSharedMutex::downgrade | ( | ) |
Downgrades exclusive ownership.to shared ownership.
Precondition: The thread has the exclusive ownership.