Free Electron
|
A locking mechanism to get cohesive state. More...
#include <StateCatalog.h>
Public Member Functions | |
Atomic (sp< StateCatalog > a_spStateCatalog) | |
Lock the StateCatalog. More... | |
Atomic (sp< StateCatalog > a_spStateCatalog, I32 &a_rFlushCount, I32 a_microSleep, volatile BWORD &a_rKeepWaiting) | |
Wait for a state change and then lock the StateCatalog. More... | |
Atomic (sp< StateCatalog > a_spStateCatalog, I32 &a_rFlushCount, I32 a_microSleep=0) | |
Wait for a state change and then lock the StateCatalog. More... | |
~Atomic (void) | |
Unlock the StateCatalog. More... | |
Result | getTypeName (String a_name, String &a_rTypeName) const |
Get state without additional locking (default property) More... | |
Result | getTypeName (String a_name, String a_property, String &a_rTypeName) const |
Get state without additional locking. More... | |
template<class T > | |
Result | getState (String a_name, T &a_rValue) const |
Get current state without additional locking. More... | |
template<class T > | |
Result | getState (String a_name, String a_property, T &a_rValue) const |
Get current state without additional locking. More... | |
I32 | spinCount (void) const |
Return an indication of how long it took for the state to change. More... | |
I32 | locked (void) const |
Return TRUE if the lock was successful. More... | |
I32 | serial (void) const |
Get the change count from when the Atomic was created. More... | |
I32 | flushCount (void) const |
Get the count of incoming updates from when the Atomic was created. More... | |
Private Attributes | |
sp< StateCatalog > | m_spStateCatalog |
BWORD | m_locked |
I32 | m_spinCount |
I32 | m_serial |
I32 | m_flushCount |
A locking mechanism to get cohesive state.
While the Atomic persists, the StateCatalog will not update. The Atomic should be released as soon as possible.
|
inline |
Lock the StateCatalog.
|
inline |
Wait for a state change and then lock the StateCatalog.
A previous flush count needs to be given as well as a spin counter.
This constructor will not return until the flush count of the StateCatalog exceeds the number sent. The reference value is set to the new flush count.
A pause time can be specified in micro seconds. If this value is zero, the spin lock is run at full speed.
The wait will stop if a_rKeepWaiting is or becomes zero.
|
inline |
Wait for a state change and then lock the StateCatalog.
This version will always keep waiting.
|
inline |
Unlock the StateCatalog.
|
inline |
|
inline |
Get current state without additional locking.
If the lock failed, this method will fail as well.
|
inline |
Get current state without additional locking.
If the lock failed, this method will fail as well.
Get state without additional locking (default property)
If the lock failed, this method will fail as well.
|
inline |
Get state without additional locking.
|
inline |
Return TRUE if the lock was successful.
If the a_keepWaiting argument changed becomes zero, the constructor can return without locking. If so, calls to getState will fail.
|
inline |
Get the change count from when the Atomic was created.
The StateCatalog keeps an serial count of how many state changes have occured.
|
inline |
Return an indication of how long it took for the state to change.
A spin count of zero means there was a change already in place before this constructor. Gauging different non-zero values may not be a useful metric.