7 #include "tools/GenericException.h"
8 #include "tools/OrderedMutex.h"
9 #include "tools/NoCopy.h"
36 void check(
const char *file,
size_t line,
37 const epicsMutex &the_one_it_should_be);
68 : mutex(guardable.getMutex()), is_locked(false)
76 : mutex(mutex), is_locked(false)
87 "Found a released lock in Guard::~Guard()");
95 void check(
const char *file,
size_t line,
106 void lock(
const char *file,
size_t line);
115 PROHIBIT_DEFAULT_COPY(
Guard);
131 : file(file), line(line), guard(guard)
139 guard.
lock(file, line);
void check(const char *file, size_t line, const epicsMutex &the_one_it_should_be)
Check.
~GuardRelease()
Destructor re-locks the guard.
Definition: Guard.h:137
epicsMutexGuard(epicsMutex &mutex)
Constructor locks mutex.
Definition: Guard.h:24
A mutex with informational name and lock order.
Definition: OrderedMutex.h:34
Guard(const char *file, size_t line, OrderedMutex &mutex)
Constructor attaches to mutex and locks.
Definition: Guard.h:75
void unlock()
Unlock the mutex.
Automatically takes and releases an epicsMutex.
Definition: Guard.h:19
~epicsMutexGuard()
Destructor unlocks mutex.
Definition: Guard.h:30
~Guard()
Destructor unlocks.
Definition: Guard.h:83
virtual OrderedMutex & getMutex()=0
Automatically takes and releases an epicsMutex.
Definition: Guard.h:63
bool isLocked()
Definition: Guard.h:109
void lock(const char *file, size_t line)
Lock again after a temporary unlock.
Interface for something that can be protected by a Guard.
Definition: Guard.h:49
void unlock()
Unlock, meant for temporary, manual unlock().
Definition: Guard.h:99
GuardRelease(const char *file, size_t line, Guard &guard)
Constructor releases the guard.
Definition: Guard.h:130
Generic Exception: Base class for exceptions.
Definition: GenericException.h:45
Guard(const char *file, size_t line, Guardable &guardable)
Constructor attaches to mutex and locks.
Definition: Guard.h:67
Temporarily releases and then re-takes a Guard.
Definition: Guard.h:126
void check(const char *file, size_t line, const OrderedMutex &the_one_it_should_be)
Check if the guard is assigned to the correct mutex.