From b01a88a839c2ac1eec68442f6cddf0c0a887cfa7 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Tue, 29 Dec 2020 00:04:58 +0100 Subject: [PATCH] Do not run timer queue if no alarm is set. --- embassy/src/executor/mod.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/embassy/src/executor/mod.rs b/embassy/src/executor/mod.rs index c1ec3832a..845d94c2c 100644 --- a/embassy/src/executor/mod.rs +++ b/embassy/src/executor/mod.rs @@ -214,9 +214,11 @@ impl Executor { /// Runs the executor until the queue is empty. pub fn run(&self) { unsafe { - self.timer_queue.dequeue_expired(Instant::now(), |p| { - self.enqueue(p); - }); + if self.alarm.is_some() { + self.timer_queue.dequeue_expired(Instant::now(), |p| { + self.enqueue(p); + }); + } self.run_queue.dequeue_all(|p| { let header = &*p;