Add comment about constraints on locking primitives.

This commit is contained in:
Martin Ling
2024-12-16 21:19:12 +00:00
parent a272e97fda
commit f3e7d10d07

View File

@ -26,6 +26,12 @@
#include <libopencm3/cm3/sync.h>
/* Primitives for implementing locking.
*
* Must always be used in a pair, with a call to load_exclusive being
* followed immediately or near-immediately by a call to store_exclusive().
* Failure to observe this rule may lead to undefined results. */
// Use ldrex and strex directly if available.
// Otherwise, disable interrupts to ensure exclusivity.
#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)