#include <spin_rw_mutex.h>
Inherits tbb::internal::no_copy.
Inheritance diagram for tbb::spin_rw_mutex_v3::scoped_lock:
Public Member Functions | |
scoped_lock () | |
Construct lock that has not acquired a mutex. | |
scoped_lock (spin_rw_mutex &m, bool write=true) | |
Acquire lock on given mutex. | |
~scoped_lock () | |
Release lock (if lock is held). | |
void | acquire (spin_rw_mutex &m, bool write=true) |
Acquire lock on given mutex. | |
bool | upgrade_to_writer () |
Upgrade reader to become a writer. | |
void | release () |
Release lock. | |
bool | downgrade_to_reader () |
Downgrade writer to become a reader. | |
bool | try_acquire (spin_rw_mutex &m, bool write=true) |
Try acquire lock on given mutex. |
It helps to avoid the common problem of forgetting to release lock. It also nicely provides the "node" for queuing locks.
|
Construct lock that has not acquired a mutex. Equivalent to zero-initialization of *this. |
|
Acquire lock on given mutex. Upon entry, *this should not be in the "have acquired a mutex" state. |
|
Upgrade reader to become a writer. Returns true if the upgrade happened without re-acquiring the lock and false if opposite |