From ad4df1c1adaec95d32b9729945fa234a988ea2f1 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Fri, 9 Aug 2024 01:05:10 +0200 Subject: cyw43: make sure to yield if doing busy-polling for interrupts. --- cyw43/src/runner.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cyw43') diff --git a/cyw43/src/runner.rs b/cyw43/src/runner.rs index 6522d40fa..959718341 100644 --- a/cyw43/src/runner.rs +++ b/cyw43/src/runner.rs @@ -365,6 +365,13 @@ where } Either4::Fourth(()) => { self.handle_irq(&mut buf).await; + + // If we do busy-polling, make sure to yield. + // `handle_irq` will only do a 32bit read if there's no work to do, which is really fast. + // Depending on optimization level, it is possible that the 32-bit read finishes on + // first poll, so it never yields and we starve all other tasks. + #[cfg(feature = "bluetooth")] + embassy_futures::yield_now().await; } } } else { -- cgit