Skip to content

Commit b55726c

Browse files
authored
Merge pull request #3242 from embassy-rs/cyw43-pls-yield
cyw43: make sure to yield if doing busy-polling for interrupts.
2 parents 3afc5e4 + ad4df1c commit b55726c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

cyw43/src/runner.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,13 @@ where
365365
}
366366
Either4::Fourth(()) => {
367367
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;
368375
}
369376
}
370377
} else {

examples/rp/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,11 @@ trouble-host = { version = "0.1.0", features = ["defmt", "gatt"] }
6464

6565
[profile.release]
6666
debug = 2
67+
lto = true
68+
opt-level = 'z'
6769

6870
[profile.dev]
71+
debug = 2
6972
lto = true
7073
opt-level = "z"
7174

0 commit comments

Comments
 (0)