/* * utility_atomicscopeguard.cpp * * Created on: Mar 21, 2021 * Author: erki */ #include "utility_atomicscopeguard.hpp" #include "cmsis_gcc.h" namespace Utility { std::int32_t AtomicScopeGuard::_reentrancy_counter; AtomicScopeGuard::AtomicScopeGuard() { __disable_irq(); _reentrancy_counter++; } AtomicScopeGuard::~AtomicScopeGuard() { _reentrancy_counter--; if (!_reentrancy_counter) __enable_irq(); } }