Tkrzw
|
Spin lock shared mutex. More...
#include <tkrzw_thread_util.h>
Public Member Functions | |
SpinSharedMutex () | |
Constructor. More... | |
SpinSharedMutex (const SpinSharedMutex &rhs)=delete | |
Copy and assignment are disabled. More... | |
SpinSharedMutex & | operator= (const SpinSharedMutex &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.
tkrzw::SpinSharedMutex::SpinSharedMutex | ( | ) |
Constructor.
|
explicitdelete |
Copy and assignment are disabled.
void tkrzw::SpinSharedMutex::lock | ( | ) |
Gets exclusive ownership of the lock.
Precondition: The thread doesn't have any ownership.
bool tkrzw::SpinSharedMutex::try_lock | ( | ) |
Tries to get exclusive ownership of the lock.
Precondition: The thread doesn't have any ownership.
void tkrzw::SpinSharedMutex::unlock | ( | ) |
Releases exclusive ownership of the lock.
Precondition: The thread has the exclusive ownership.
void tkrzw::SpinSharedMutex::lock_shared | ( | ) |
Gets shared ownership of the lock.
Precondition: The thread doesn't have any ownership.
bool tkrzw::SpinSharedMutex::try_lock_shared | ( | ) |
Tries to get shared ownership of the lock.
Precondition: The thread doesn't have any ownership.
void tkrzw::SpinSharedMutex::unlock_shared | ( | ) |
Releases shared ownership of the lock.
Precondition: The thread has the shared ownership.
bool tkrzw::SpinSharedMutex::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::SpinSharedMutex::downgrade | ( | ) |
Downgrades exclusive ownership.to shared ownership.
Precondition: The thread has the exclusive ownership.