aboutsummaryrefslogtreecommitdiff
path: root/embassy-executor/src/raw/timer_queue.rs
blob: 46e346c1b45149805ca486eacd4e72d59dd503c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//! Timer queue operations.

use core::cell::Cell;

use super::TaskRef;

/// An item in the timer queue.
pub struct TimerQueueItem {
    /// The next item in the queue.
    pub next: Cell<Option<TaskRef>>,

    /// The time at which this item expires.
    pub expires_at: Cell<u64>,
}

unsafe impl Sync for TimerQueueItem {}

impl TimerQueueItem {
    pub(crate) const fn new() -> Self {
        Self {
            next: Cell::new(None),
            expires_at: Cell::new(0),
        }
    }
}