AAO DRAMA/DRAMA2 C++ Interface
DRAMA C++11 and later interface

◆ ScopeGuardAtomic() [2/2]

template<typename AT , typename T >
drama::ScopeGuardAtomic< AT, T >::ScopeGuardAtomic ( AT item,
const executionVal,
const exitVal 
)
inline

Construct a ScopeGuardAtomic for the specified item.

It is set to the "executionVal" value at this point. When the destructor is invoked, it is set to the specified exitVal value.

Note
The value in the item is not protected during the existence of this object. It is set to executionVal when this object is constructed and set back to its initial value when the object is destroyed, but nothing prevents it being changed while the object exists, and in that case, the changed value is overwritten when this object is destroyed.
Parameters
itemThe item to be guarded. The type of this must be an instantiation of std::atomic
executionValThe value that should be placed in the item when this constructed is executed. The type of this must be type used to instantiate std::atomic when constructing item.
exitValThe value to be put in the item when this object is destroyed. The type of this must be type used to instantiate std::atomic when constructing item.

References drama::CreateRunDramaTask().