diff options
author | 2017-07-29 00:34:00 -0500 | |
---|---|---|
committer | 2017-07-29 00:46:38 -0500 | |
commit | 2d80f3631bc3bf382ae24c25dbf8ff33af2ad430 (patch) | |
tree | 549db01071e63ac232ab5781771fbb3993a9d822 /examples/preemption.rs | |
parent | e85d6e53c89cd1ea1da8826778c5a74154fb651d (diff) | |
download | rtic-2d80f3631bc3bf382ae24c25dbf8ff33af2ad430.tar.gz rtic-2d80f3631bc3bf382ae24c25dbf8ff33af2ad430.tar.zst rtic-2d80f3631bc3bf382ae24c25dbf8ff33af2ad430.zip |
update examplesrelease/v0.1
Diffstat (limited to 'examples/preemption.rs')
-rw-r--r-- | examples/preemption.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/preemption.rs b/examples/preemption.rs index 256b9bdd..5fda37d5 100644 --- a/examples/preemption.rs +++ b/examples/preemption.rs @@ -1,6 +1,5 @@ //! Two tasks running at *different* priorities with access to the same resource #![deny(unsafe_code)] -#![feature(const_fn)] #![feature(proc_macro)] #![no_std] @@ -58,8 +57,11 @@ fn tim2(t: &mut Threshold, mut r: TIM2::Resources) { // As this task runs at lower priority it needs a critical section to // prevent `sys_tick` from preempting it while it modifies this resource // data. The critical section is required to prevent data races which can - // lead to undefined behavior - r.COUNTER.claim_mut(t, |counter, _t| { **counter += 1; }); + // lead to undefined behavior. + r.COUNTER.claim_mut(t, |counter, _t| { + // `claim_mut` creates a critical section + **counter += 1; + }); // .. } |