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