Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
interrupt_atomic< T > Class Template Reference

#include <MIDI_Interfaces/USBMIDI/util/Atomic.hpp>

Detailed Description

template<class T>
class interrupt_atomic< T >

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.

+ Collaboration diagram for interrupt_atomic< T >:

Public Member Functions

 interrupt_atomic () noexcept=default
 
 interrupt_atomic (T t) noexcept
 
load (std::memory_order o) const
 
void store (T t, std::memory_order o) noexcept
 
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
 
fetch_add (T arg, std::memory_order o)
 
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
 

Constructor & Destructor Documentation

◆ interrupt_atomic() [1/2]

template<class T >
interrupt_atomic ( )
defaultnoexcept

◆ interrupt_atomic() [2/2]

template<class T >
interrupt_atomic ( T t)
inlineexplicitnoexcept

Definition at line 84 of file Atomic.hpp.

Member Function Documentation

◆ after_load_fence()

template<class T >
static void after_load_fence ( std::memory_order o)
inlinestaticnoexcept

Definition at line 87 of file Atomic.hpp.

◆ before_store_fence()

template<class T >
static void before_store_fence ( std::memory_order o)
inlinestaticnoexcept

Definition at line 106 of file Atomic.hpp.

◆ load()

template<class T >
T load ( std::memory_order o) const
inline

Definition at line 124 of file Atomic.hpp.

◆ store()

template<class T >
void store ( T t,
std::memory_order o )
inlinenoexcept

Definition at line 132 of file Atomic.hpp.

◆ exchange()

template<class T >
T exchange ( T arg,
std::memory_order o )
inline

Definition at line 140 of file Atomic.hpp.

◆ compare_exchange_strong()

template<class T >
bool compare_exchange_strong ( T & expected,
T desired,
std::memory_order o )
inlinenoexcept

Definition at line 148 of file Atomic.hpp.

◆ compare_exchange_weak()

template<class T >
bool compare_exchange_weak ( T & expected,
T desired,
std::memory_order o )
inlinenoexcept

Definition at line 158 of file Atomic.hpp.

◆ fetch_add()

template<class T >
T fetch_add ( T arg,
std::memory_order o )
inline

Definition at line 167 of file Atomic.hpp.

◆ fetch_sub()

template<class T >
T fetch_sub ( T arg,
std::memory_order o )
inline

Definition at line 174 of file Atomic.hpp.

Member Data Documentation

◆ value

template<class T >
std::atomic<T> value
private

Definition at line 230 of file Atomic.hpp.


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