44 unsigned int count = 0;
50 inline void lock() { mutex.lock(); count++; }
51 inline bool try_lock() {
return mutex.try_lock() ? count++, true :
false; }
52 inline void unlock() { count--; mutex.unlock(); }
58 inline bool IsLocked()
const {
return count > 0; }
63 inline unsigned int exit(
unsigned int leave = 0)
70 if (leave < (count - 1))
72 ret = count - 1 - leave;
77 for (
unsigned int i = 0; i < ret; i++)
89 inline void restore(
unsigned int restoreCount)
91 for (
unsigned int i = 0; i < restoreCount; i++)
This template will take any implementation of the "Lockable" concept and allow it to be used as an "E...
Definition: Lockables.h:36
void restore(unsigned int restoreCount)
Restore a previous exit to the provided level.
Definition: Lockables.h:89
This is a thin wrapper around std::condition_variable_any.
Definition: Condition.h:26
L & get_underlying()
Some implementations (see pthreads) require access to the underlying CCriticalSection, which is also implementation specific.
Definition: Lockables.h:104
unsigned int exit(unsigned int leave=0)
This implements the "exitable" behavior mentioned above.
Definition: Lockables.h:63
bool IsLocked() const
Check if have a lock owned.
Definition: Lockables.h:58
Definition: RecursiveMutex.cpp:11