diff options
| author | Dario Nieuwenhuis <[email protected]> | 2024-08-09 01:05:10 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2024-08-09 01:07:52 +0200 |
| commit | ad4df1c1adaec95d32b9729945fa234a988ea2f1 (patch) | |
| tree | 82c55e477ba44dbbbf9f4067153012442c2d48b9 /cyw43 | |
| parent | 3afc5e48388d07bf521af12fd9d9a2a87f8ebd99 (diff) | |
cyw43: make sure to yield if doing busy-polling for interrupts.
Diffstat (limited to 'cyw43')
| -rw-r--r-- | cyw43/src/runner.rs | 7 |
1 files changed, 7 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 { |
