DUECA/DUSIME
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dueca::StateGuard Class Reference

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 vstringgetName ()
 Return the name.
 

Detailed Description

Class that guards against race conditions.

DUECA internal use.

Constructor & Destructor Documentation

◆ StateGuard()

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.

Member Function Documentation

◆ tryState()

bool dueca::StateGuard::tryState ( ) const

Try to get access to the state.

If free, you get it, otherwise this returns false.


The documentation for this class was generated from the following file: