mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
|
Convenience class for automatically setting and unsetting an atomic boolean based on the object's scope. Useful e.g. for indicating whether a thread is running or not. More...
#include <utils.h>
Public Member Functions | |
AtomicScopeFlag (std::atomic< bool > &in) | |
The constructor. Sets the flag in to true . More... | |
~AtomicScopeFlag () | |
The destructor. Resets the variable given in the constructor to false . More... | |
Convenience class for automatically setting and unsetting an atomic boolean based on the object's scope. Useful e.g. for indicating whether a thread is running or not.
mrs_lib::AtomicScopeFlag::AtomicScopeFlag | ( | std::atomic< bool > & | in | ) |
The constructor. Sets the flag in
to true
.
in | The flag to be set on construction of this object and reset (set to false ) on its destruction. |
mrs_lib::AtomicScopeFlag::~AtomicScopeFlag | ( | ) |
The destructor. Resets the variable given in the constructor to false
.