#include <MIDI_Interfaces/USBMIDI/util/Atomic.hpp>
Wrapper that provides atomic access to variables shared between the main program and interrupt handlers, by inserting the appropriate compile-time fences.
On chips that don't implement any atomic instructions in hardware, like the Cortex-M0, interrupts may be disabled to ensure atomicity of read- modify-write operations. Interface derived from std::atomic
.
Definition at line 81 of file Atomic.hpp.
Public Member Functions | |
interrupt_atomic () noexcept=default | |
interrupt_atomic (T t) noexcept | |
T | load (std::memory_order o) const |
void | store (T t, std::memory_order o) noexcept |
T | exchange (T arg, std::memory_order o) |
bool | compare_exchange_strong (T &expected, T desired, std::memory_order o) noexcept |
bool | compare_exchange_weak (T &expected, T desired, std::memory_order o) noexcept |
T | fetch_add (T arg, std::memory_order o) |
T | fetch_sub (T arg, std::memory_order o) |
Static Public Member Functions | |
static void | after_load_fence (std::memory_order o) noexcept |
static void | before_store_fence (std::memory_order o) noexcept |
Private Attributes | |
std::atomic< T > | value |
|
defaultnoexcept |
|
inlineexplicitnoexcept |
Definition at line 84 of file Atomic.hpp.
Definition at line 87 of file Atomic.hpp.
Definition at line 106 of file Atomic.hpp.
Definition at line 124 of file Atomic.hpp.
Definition at line 132 of file Atomic.hpp.
Definition at line 140 of file Atomic.hpp.
Definition at line 148 of file Atomic.hpp.
Definition at line 158 of file Atomic.hpp.
Definition at line 167 of file Atomic.hpp.
Definition at line 174 of file Atomic.hpp.
Definition at line 230 of file Atomic.hpp.