Skip to content

Commit

Permalink
Refine comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Finomnis committed Dec 6, 2023
1 parent e13be33 commit 5253905
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions rtic-time/src/half_period_counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,9 @@ where
// it could lead to erroneous behavior if preempted in between the two reads.

let (half_periods, timer_value) = critical_section::with(|_| {
// Important: half_period **must** be read first.
// Otherwise we have another mathematical race condition.
// Important: half_periods **must** be read first.
// Otherwise the mathematical principle that prevents
// the race condition does not work.
let half_periods = O::from(half_periods());
compiler_fence(Ordering::Acquire);
let timer_value = O::from(timer_value());
Expand Down

0 comments on commit 5253905

Please sign in to comment.