Lunchbox
1.14.0
Multi-threaded C++ toolbox library for all application developers creating high-performance multi-threaded programs.
|
A lock (mutex) primitive. More...
#include <lock.h>
Public Member Functions | |
Lock () | |
Construct a new lock. More... | |
~Lock () | |
Destruct the lock. More... | |
void | set () |
Acquire the lock. More... | |
void | unset () |
Release the lock. More... | |
void | setRead () |
Acquire the lock shared with other readers. More... | |
void | unsetRead () |
Release a shared read lock. More... | |
bool | trySet () |
Attempt to acquire the lock. More... | |
bool | isSet () |
Test if the lock is set. More... | |
A lock (mutex) primitive.
Example:
lunchbox::Lock::Lock | ( | ) |
Construct a new lock.
lunchbox::Lock::~Lock | ( | ) |
Destruct the lock.
bool lunchbox::Lock::isSet | ( | ) |
Test if the lock is set.
true
if the lock is set, false
if it is not set. void lunchbox::Lock::set | ( | ) |
Acquire the lock.
|
inline |
bool lunchbox::Lock::trySet | ( | ) |
Attempt to acquire the lock.
This method implements an atomic test-and-set operation.
true
if the lock was set, false
if it was not set. void lunchbox::Lock::unset | ( | ) |
Release the lock.
|
inline |