diff options
Diffstat (limited to 'embassy-executor/src/raw/deadline.rs')
| -rw-r--r-- | embassy-executor/src/raw/deadline.rs | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/embassy-executor/src/raw/deadline.rs b/embassy-executor/src/raw/deadline.rs index f6d016ae7..cc89fadb0 100644 --- a/embassy-executor/src/raw/deadline.rs +++ b/embassy-executor/src/raw/deadline.rs | |||
| @@ -7,7 +7,7 @@ use core::sync::atomic::{AtomicU32, Ordering}; | |||
| 7 | /// Note: Interacting with the deadline should be done locally in a task. | 7 | /// Note: Interacting with the deadline should be done locally in a task. |
| 8 | /// In theory you could try to set or read the deadline from another task, | 8 | /// In theory you could try to set or read the deadline from another task, |
| 9 | /// but that will result in weird (though not unsound) behavior. | 9 | /// but that will result in weird (though not unsound) behavior. |
| 10 | pub struct Deadline { | 10 | pub(crate) struct Deadline { |
| 11 | instant_ticks_hi: AtomicU32, | 11 | instant_ticks_hi: AtomicU32, |
| 12 | instant_ticks_lo: AtomicU32, | 12 | instant_ticks_lo: AtomicU32, |
| 13 | } | 13 | } |
| @@ -21,7 +21,7 @@ impl Deadline { | |||
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | pub(crate) const fn new_unset() -> Self { | 23 | pub(crate) const fn new_unset() -> Self { |
| 24 | Self::new(Self::UNSET_DEADLINE_TICKS) | 24 | Self::new(Self::UNSET_TICKS) |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | pub(crate) fn set(&self, instant_ticks: u64) { | 27 | pub(crate) fn set(&self, instant_ticks: u64) { |
| @@ -31,7 +31,7 @@ impl Deadline { | |||
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | /// Deadline value in ticks, same time base and ticks as `embassy-time` | 33 | /// Deadline value in ticks, same time base and ticks as `embassy-time` |
| 34 | pub fn instant_ticks(&self) -> u64 { | 34 | pub(crate) fn instant_ticks(&self) -> u64 { |
| 35 | let hi = self.instant_ticks_hi.load(Ordering::Relaxed) as u64; | 35 | let hi = self.instant_ticks_hi.load(Ordering::Relaxed) as u64; |
| 36 | let lo = self.instant_ticks_lo.load(Ordering::Relaxed) as u64; | 36 | let lo = self.instant_ticks_lo.load(Ordering::Relaxed) as u64; |
| 37 | 37 | ||
| @@ -40,11 +40,5 @@ impl Deadline { | |||
| 40 | 40 | ||
| 41 | /// Sentinel value representing an "unset" deadline, which has lower priority | 41 | /// Sentinel value representing an "unset" deadline, which has lower priority |
| 42 | /// than any other set deadline value | 42 | /// than any other set deadline value |
| 43 | pub const UNSET_DEADLINE_TICKS: u64 = u64::MAX; | 43 | pub(crate) const UNSET_TICKS: u64 = u64::MAX; |
| 44 | |||
| 45 | /// Does the given Deadline represent an "unset" deadline? | ||
| 46 | #[inline] | ||
| 47 | pub fn is_unset(&self) -> bool { | ||
| 48 | self.instant_ticks() == Self::UNSET_DEADLINE_TICKS | ||
| 49 | } | ||
| 50 | } | 44 | } |
