reference-en icon indicating copy to clipboard operation
reference-en copied to clipboard

ATOMIC_BLOCK: Documentation and Compatibility List

Open TimMathias opened this issue 4 years ago • 1 comments

Please could you add some documentation describing the ATOMIC_BLOCK macro with a list of boards/architectures that support it or do not support it as the case my be? I would like to conditionally encapsulate some code within an ATOMIC_BLOCK for the systems that support it. Thank you.

#ifdef SOME_BOARDS_OR_ARCH
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
{
#endif
  // Some code.
#ifdef SOME_BOARDS_OR_ARCH
}
#endif

TimMathias avatar Jul 22 '20 03:07 TimMathias

This is an alternative method:

#ifdef ATOMIC_BLOCK
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
{
#endif
  // Some code.
#ifdef ATOMIC_BLOCK
}
#endif

TimMathias avatar Aug 10 '20 16:08 TimMathias