aboutsummaryrefslogtreecommitdiff
path: root/embassy-executor/src/raw/state_critical_section.rs
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-executor/src/raw/state_critical_section.rs')
-rw-r--r--embassy-executor/src/raw/state_critical_section.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/embassy-executor/src/raw/state_critical_section.rs b/embassy-executor/src/raw/state_critical_section.rs
index 6b627ff79..ec08f2f58 100644
--- a/embassy-executor/src/raw/state_critical_section.rs
+++ b/embassy-executor/src/raw/state_critical_section.rs
@@ -4,12 +4,12 @@ pub(crate) use critical_section::{with as locked, CriticalSection as Token};
4use critical_section::{CriticalSection, Mutex}; 4use critical_section::{CriticalSection, Mutex};
5 5
6/// Task is spawned (has a future) 6/// Task is spawned (has a future)
7pub(crate) const STATE_SPAWNED: u32 = 1 << 0; 7pub(crate) const STATE_SPAWNED: u8 = 1 << 0;
8/// Task is in the executor run queue 8/// Task is in the executor run queue
9pub(crate) const STATE_RUN_QUEUED: u32 = 1 << 1; 9pub(crate) const STATE_RUN_QUEUED: u8 = 1 << 1;
10 10
11pub(crate) struct State { 11pub(crate) struct State {
12 state: Mutex<Cell<u32>>, 12 state: Mutex<Cell<u8>>,
13} 13}
14 14
15impl State { 15impl State {
@@ -19,11 +19,11 @@ impl State {
19 } 19 }
20 } 20 }
21 21
22 fn update<R>(&self, f: impl FnOnce(&mut u32) -> R) -> R { 22 fn update<R>(&self, f: impl FnOnce(&mut u8) -> R) -> R {
23 critical_section::with(|cs| self.update_with_cs(cs, f)) 23 critical_section::with(|cs| self.update_with_cs(cs, f))
24 } 24 }
25 25
26 fn update_with_cs<R>(&self, cs: CriticalSection<'_>, f: impl FnOnce(&mut u32) -> R) -> R { 26 fn update_with_cs<R>(&self, cs: CriticalSection<'_>, f: impl FnOnce(&mut u8) -> R) -> R {
27 let s = self.state.borrow(cs); 27 let s = self.state.borrow(cs);
28 let mut val = s.get(); 28 let mut val = s.get();
29 let r = f(&mut val); 29 let r = f(&mut val);