aboutsummaryrefslogtreecommitdiff
path: root/embassy-executor/src/raw/timer_queue.rs
diff options
context:
space:
mode:
authorsander <[email protected]>2023-03-30 14:37:51 +0200
committersander <[email protected]>2023-03-30 14:37:51 +0200
commit6b2aaacf830d69fcb05f9611d3780f56b4ae82bc (patch)
treea6e4d7628cd5153bbfd122b902a598b0862feeb9 /embassy-executor/src/raw/timer_queue.rs
parentba9afbc26d06ab38065cbff5b17a7f76db297ad4 (diff)
parent754bb802ba377c19be97d092c4b2afe542de20b5 (diff)
Update embassy
Merge commit '9dd3719f09835f646e3a8f3abaa33726a1e3f9ca'
Diffstat (limited to 'embassy-executor/src/raw/timer_queue.rs')
-rw-r--r--embassy-executor/src/raw/timer_queue.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/embassy-executor/src/raw/timer_queue.rs b/embassy-executor/src/raw/timer_queue.rs
index 57d6d3cda..dc71c95b1 100644
--- a/embassy-executor/src/raw/timer_queue.rs
+++ b/embassy-executor/src/raw/timer_queue.rs
@@ -1,28 +1,32 @@
1use core::cell::Cell;
2use core::cmp::min; 1use core::cmp::min;
3 2
4use atomic_polyfill::Ordering; 3use atomic_polyfill::Ordering;
5use embassy_time::Instant; 4use embassy_time::Instant;
6 5
7use super::{TaskRef, STATE_TIMER_QUEUED}; 6use super::{TaskRef, STATE_TIMER_QUEUED};
7use crate::raw::util::SyncUnsafeCell;
8 8
9pub(crate) struct TimerQueueItem { 9pub(crate) struct TimerQueueItem {
10 next: Cell<Option<TaskRef>>, 10 next: SyncUnsafeCell<Option<TaskRef>>,
11} 11}
12 12
13impl TimerQueueItem { 13impl TimerQueueItem {
14 pub const fn new() -> Self { 14 pub const fn new() -> Self {
15 Self { next: Cell::new(None) } 15 Self {
16 next: SyncUnsafeCell::new(None),
17 }
16 } 18 }
17} 19}
18 20
19pub(crate) struct TimerQueue { 21pub(crate) struct TimerQueue {
20 head: Cell<Option<TaskRef>>, 22 head: SyncUnsafeCell<Option<TaskRef>>,
21} 23}
22 24
23impl TimerQueue { 25impl TimerQueue {
24 pub const fn new() -> Self { 26 pub const fn new() -> Self {
25 Self { head: Cell::new(None) } 27 Self {
28 head: SyncUnsafeCell::new(None),
29 }
26 } 30 }
27 31
28 pub(crate) unsafe fn update(&self, p: TaskRef) { 32 pub(crate) unsafe fn update(&self, p: TaskRef) {