Skip to content

Commit

Permalink
Add comment about constraints on locking primitives.
Browse files Browse the repository at this point in the history
  • Loading branch information
martinling committed Dec 16, 2024
1 parent a272e97 commit f3e7d10
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions firmware/common/locking.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down

0 comments on commit f3e7d10

Please sign in to comment.