mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-25 21:19:35 +01:00
Fix a bug in the timer queue due to comparison bug in embedded-time
This commit is contained in:
parent
8940c50fa7
commit
cdab00a0c6
1 changed files with 5 additions and 2 deletions
|
@ -111,7 +111,9 @@ where
|
|||
mono.clear_compare_flag();
|
||||
|
||||
if let Some(instant) = self.0.peek().map(|p| p.instant) {
|
||||
if instant <= unwrapper(Clock::try_now(mono)) {
|
||||
let now = unwrapper(Clock::try_now(mono));
|
||||
// This if statement is like this and not <= due to a bug in embedded-time
|
||||
if instant < now || instant == now {
|
||||
// task became ready
|
||||
let nr = unsafe { self.0.pop_unchecked() };
|
||||
|
||||
|
@ -124,7 +126,8 @@ where
|
|||
// dequeue. If the monotonic is fast enough it can happen that from the
|
||||
// read of now to the set of the compare, the time can overflow. This is to
|
||||
// guard against this.
|
||||
if instant <= unwrapper(Clock::try_now(mono)) {
|
||||
let now = unwrapper(Clock::try_now(mono));
|
||||
if instant < now || instant == now {
|
||||
let nr = unsafe { self.0.pop_unchecked() };
|
||||
|
||||
Some((nr.task, nr.index))
|
||||
|
|
Loading…
Reference in a new issue