A lock for multithreading.
More...
#include <misc/pv/lock.h>
A lock for multithreading.
This is based on item 14 of
- Effective C++, Third Edition, Scott Meyers
Definition at line 36 of file lock.h.
epics::pvData::Lock::Lock |
( |
Mutex & |
m | ) |
|
|
inlineexplicit |
Constructor
- Parameters
-
m | The mutex for the facility being locked. |
Definition at line 43 of file lock.h.
epics::pvData::Lock::~Lock |
( |
| ) |
|
|
inline |
Destructor Note that destructor does an automatic unlock.
Definition at line 50 of file lock.h.
void epics::pvData::Lock::lock |
( |
| ) |
|
|
inline |
Take the lock Recursive locks are supported but each lock must be matched with an unlock.
Definition at line 55 of file lock.h.
bool epics::pvData::Lock::ownsLock |
( |
| ) |
const |
|
inline |
See if caller has the lock,
- Returns
- (false,true) if caller (does not have, has) the lock.
Definition at line 91 of file lock.h.
bool epics::pvData::Lock::tryLock |
( |
| ) |
|
|
inline |
If lock is not held take the lock.
- Returns
- (false,true) if caller (does not have, has) the lock.
Definition at line 78 of file lock.h.
void epics::pvData::Lock::unlock |
( |
| ) |
|
|
inline |
release the lock.
Definition at line 66 of file lock.h.
The documentation for this class was generated from the following file: