aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2024-08-09 01:05:10 +0200
committerDario Nieuwenhuis <[email protected]>2024-08-09 01:07:52 +0200
commitad4df1c1adaec95d32b9729945fa234a988ea2f1 (patch)
tree82c55e477ba44dbbbf9f4067153012442c2d48b9
parent3afc5e48388d07bf521af12fd9d9a2a87f8ebd99 (diff)
cyw43: make sure to yield if doing busy-polling for interrupts.
-rw-r--r--cyw43/src/runner.rs7
-rw-r--r--examples/rp/Cargo.toml3
2 files changed, 10 insertions, 0 deletions
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
365 } 365 }
366 Either4::Fourth(()) => { 366 Either4::Fourth(()) => {
367 self.handle_irq(&mut buf).await; 367 self.handle_irq(&mut buf).await;
368
369 // If we do busy-polling, make sure to yield.
370 // `handle_irq` will only do a 32bit read if there's no work to do, which is really fast.
371 // Depending on optimization level, it is possible that the 32-bit read finishes on
372 // first poll, so it never yields and we starve all other tasks.
373 #[cfg(feature = "bluetooth")]
374 embassy_futures::yield_now().await;
368 } 375 }
369 } 376 }
370 } else { 377 } else {
diff --git a/examples/rp/Cargo.toml b/examples/rp/Cargo.toml
index 2884ca85a..031f68253 100644
--- a/examples/rp/Cargo.toml
+++ b/examples/rp/Cargo.toml
@@ -64,8 +64,11 @@ trouble-host = { version = "0.1.0", features = ["defmt", "gatt"] }
64 64
65[profile.release] 65[profile.release]
66debug = 2 66debug = 2
67lto = true
68opt-level = 'z'
67 69
68[profile.dev] 70[profile.dev]
71debug = 2
69lto = true 72lto = true
70opt-level = "z" 73opt-level = "z"
71 74