mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
mrs_lib::AtomicScopeFlag Class Reference

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ AtomicScopeFlag()

mrs_lib::AtomicScopeFlag::AtomicScopeFlag ( std::atomic< bool > &  in)

The constructor. Sets the flag in to true.

Parameters
inThe flag to be set on construction of this object and reset (set to false) on its destruction.

◆ ~AtomicScopeFlag()

mrs_lib::AtomicScopeFlag::~AtomicScopeFlag ( )

The destructor. Resets the variable given in the constructor to false.


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