Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
#include <Lockables.h>
Public Member Functions | |
CountingLockable ()=default | |
void | lock () |
bool | try_lock () |
void | unlock () |
bool | IsLocked () const |
Check if have a lock owned. | |
unsigned int | exit (unsigned int leave=0) |
void | restore (unsigned int restoreCount) |
L & | get_underlying () |
Protected Attributes | |
L | mutex |
unsigned int | count = 0 |
Friends | |
class | ConditionVariable |
This template will take any implementation of the "Lockable" concept and allow it to be used as an "Exitable Lockable."
Something that implements the "Lockable concept" simply means that it has the three methods:
lock(); try_lock(); unlock(); IsLocked();
"Exitable" specifically means that, no matter how deep the recursion on the mutex/critical section, we can exit from it and then restore the state.
This requires us to extend the Lockable so that we can keep track of the number of locks that have been recursively acquired so that we can undo it, and then restore that (See class CSingleExit).
All xbmc code expects Lockables to be recursive.
|
inlinedefault |
|
inline |
This implements the "exitable" behavior mentioned above.
|
inline |
Some implementations (see pthreads) require access to the underlying CCriticalSection, which is also implementation specific. This provides access to it through the same method on the guard classes UniqueLock, and SharedLock.
There really should be no need for the users of the threading library to call this method.
|
inline |
Check if have a lock owned.
|
inline |
|
inline |
Restore a previous exit to the provided level.
|
inline |
|
inline |
|
friend |
|
protected |
|
protected |