Fix a bug identified during code review

This commit is contained in:
ivmarkov 2022-10-26 17:48:22 +03:00
parent 516f4ce946
commit ac6995f9e6

View File

@ -1,5 +1,5 @@
use core::cell::RefCell; use core::cell::RefCell;
use core::cmp::Ordering; use core::cmp::{min, Ordering};
use core::task::Waker; use core::task::Waker;
use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
@ -74,7 +74,7 @@ impl InnerQueue {
self.queue self.queue
.find_mut(|timer| timer.waker.will_wake(waker)) .find_mut(|timer| timer.waker.will_wake(waker))
.map(|mut timer| { .map(|mut timer| {
timer.at = at; timer.at = min(timer.at, at);
timer.finish(); timer.finish();
}) })
.unwrap_or_else(|| { .unwrap_or_else(|| {