diff options
Diffstat (limited to 'embassy-executor/src/raw/timer_queue.rs')
| -rw-r--r-- | embassy-executor/src/raw/timer_queue.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/embassy-executor/src/raw/timer_queue.rs b/embassy-executor/src/raw/timer_queue.rs index 46e346c1b..c36708401 100644 --- a/embassy-executor/src/raw/timer_queue.rs +++ b/embassy-executor/src/raw/timer_queue.rs | |||
| @@ -7,6 +7,9 @@ use super::TaskRef; | |||
| 7 | /// An item in the timer queue. | 7 | /// An item in the timer queue. |
| 8 | pub struct TimerQueueItem { | 8 | pub struct TimerQueueItem { |
| 9 | /// The next item in the queue. | 9 | /// The next item in the queue. |
| 10 | /// | ||
| 11 | /// If this field contains `Some`, the item is in the queue. The last item in the queue has a | ||
| 12 | /// value of `Some(dangling_pointer)` | ||
| 10 | pub next: Cell<Option<TaskRef>>, | 13 | pub next: Cell<Option<TaskRef>>, |
| 11 | 14 | ||
| 12 | /// The time at which this item expires. | 15 | /// The time at which this item expires. |
| @@ -19,7 +22,17 @@ impl TimerQueueItem { | |||
| 19 | pub(crate) const fn new() -> Self { | 22 | pub(crate) const fn new() -> Self { |
| 20 | Self { | 23 | Self { |
| 21 | next: Cell::new(None), | 24 | next: Cell::new(None), |
| 22 | expires_at: Cell::new(0), | 25 | expires_at: Cell::new(u64::MAX), |
| 23 | } | 26 | } |
| 24 | } | 27 | } |
| 25 | } | 28 | } |
| 29 | |||
| 30 | /// The operation to perform after `timer_enqueue` is called. | ||
| 31 | #[derive(Debug, Copy, Clone, PartialEq)] | ||
| 32 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 33 | pub enum TimerEnqueueOperation { | ||
| 34 | /// Enqueue the task. | ||
| 35 | Enqueue, | ||
| 36 | /// Update the task's expiration time. | ||
| 37 | Ignore, | ||
| 38 | } | ||
