DUECA/DUSIME
|
Class that guards against race conditions. More...
#include <StateGuard.hxx>
Public Member Functions | |
StateGuard (const char *name="anon", bool lockit=true) | |
Constructor. | |
~StateGuard () | |
Destructor. | |
void | accessState () const |
Request to enter the state. | |
void | accessState (const char *txt) const |
Request to enter the state, with a description, use this form if you need more info at debugging. | |
void | leaveState () const |
Release access to the state again. | |
void | leaveState (const char *txt) const |
Release access to the state again, with a description, use this form if you need more info at debugging. | |
bool | tryState () const |
Try to get access to the state. | |
bool | tryState (const char *txt) const |
Try to get access to the state, with a description, use this form if you need more info at debugging. | |
const vstring & | getName () |
Return the name. | |
Class that guards against race conditions.
DUECA internal use.
Constructor.
If lockit is true, it leaves the guard in a locked state, use leaveState() to get out of that.
bool dueca::StateGuard::tryState | ( | ) | const |
Try to get access to the state.
If free, you get it, otherwise this returns false.