skullc-peripherals/Utility/Src/utility_atomicscopeguard.cpp
Erki faa1685e18
All checks were successful
continuous-integration/drone/push Build is passing
Add async UART logger (running on DMA).
2021-03-21 17:03:06 +02:00

33 lines
438 B
C++

/*
* 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();
}
}