Shaka Player Embedded
|
#include <shared_lock.h>
Public Member Functions | |
shared_mutex () | |
~shared_mutex () | |
SHAKA_NON_COPYABLE_OR_MOVABLE_TYPE (shared_mutex) | |
void | lock () |
bool | try_lock () |
void | unlock () |
void | lock_shared () |
bool | try_lock_shared () |
void | unlock_shared () |
A simple implementation of a reader-writer mutex where:
You can use std::unique_lock<T> to help locking this in exclusive mode. For example:
Or you can use shared_lock to lock in shared mode:
This implements the Lockable, Mutex, and SharedMutex concepts.
Definition at line 57 of file shared_lock.h.
shaka::util::shared_mutex::shared_mutex | ( | ) |
Definition at line 22 of file shared_lock.cc.
shaka::util::shared_mutex::~shared_mutex | ( | ) |
Definition at line 28 of file shared_lock.cc.
|
inline |
Locks the mutex for exclusive access.
Definition at line 65 of file shared_lock.h.
|
inline |
Locks the mutex for shared access.
Definition at line 79 of file shared_lock.h.
shaka::util::shared_mutex::SHAKA_NON_COPYABLE_OR_MOVABLE_TYPE | ( | shared_mutex | ) |
|
inline |
Tries to lock the mutex for exclusive access in a non-blocking way.
Definition at line 70 of file shared_lock.h.
|
inline |
Tries to lock the mutex for shared access in a non-blocking way.
Definition at line 84 of file shared_lock.h.
void shaka::util::shared_mutex::unlock | ( | ) |
Unlocks the mutex from exclusive access.
Definition at line 37 of file shared_lock.cc.
void shaka::util::shared_mutex::unlock_shared | ( | ) |
Unlocks the mutex from shared access.
Definition at line 51 of file shared_lock.cc.