diff options
| author | Dario Nieuwenhuis <[email protected]> | 2024-04-14 22:30:46 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-04-14 22:30:46 +0200 |
| commit | 70283f128a0ff246c8793f81b9f7c5153431eb9b (patch) | |
| tree | d0467ba0bed996854352f623493a2e25fca349a7 | |
| parent | 2f5023f4a725cba2b3d34c4b23ab5781c556b49c (diff) | |
| parent | e147f29b5ccbe94fb0703a4cb37ce6a403c321f3 (diff) | |
Merge pull request #2795 from simpkins/futures_test
Fix embassy-futures test failure
| -rwxr-xr-x | .github/ci/test.sh | 1 | ||||
| -rw-r--r-- | embassy-futures/src/yield_now.rs | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/.github/ci/test.sh b/.github/ci/test.sh index 6cb3a4bff..41da644fc 100755 --- a/.github/ci/test.sh +++ b/.github/ci/test.sh | |||
| @@ -8,6 +8,7 @@ export RUSTUP_HOME=/ci/cache/rustup | |||
| 8 | export CARGO_HOME=/ci/cache/cargo | 8 | export CARGO_HOME=/ci/cache/cargo |
| 9 | export CARGO_TARGET_DIR=/ci/cache/target | 9 | export CARGO_TARGET_DIR=/ci/cache/target |
| 10 | 10 | ||
| 11 | cargo test --manifest-path ./embassy-futures/Cargo.toml | ||
| 11 | cargo test --manifest-path ./embassy-sync/Cargo.toml | 12 | cargo test --manifest-path ./embassy-sync/Cargo.toml |
| 12 | cargo test --manifest-path ./embassy-embedded-hal/Cargo.toml | 13 | cargo test --manifest-path ./embassy-embedded-hal/Cargo.toml |
| 13 | cargo test --manifest-path ./embassy-hal-internal/Cargo.toml | 14 | cargo test --manifest-path ./embassy-hal-internal/Cargo.toml |
diff --git a/embassy-futures/src/yield_now.rs b/embassy-futures/src/yield_now.rs index bb3c67d17..4d4e535f2 100644 --- a/embassy-futures/src/yield_now.rs +++ b/embassy-futures/src/yield_now.rs | |||
| @@ -9,10 +9,16 @@ use core::task::{Context, Poll}; | |||
| 9 | /// hold, while still allowing other tasks to run concurrently (not monopolizing | 9 | /// hold, while still allowing other tasks to run concurrently (not monopolizing |
| 10 | /// the executor thread). | 10 | /// the executor thread). |
| 11 | /// | 11 | /// |
| 12 | /// ```rust,no_run | 12 | /// ```rust |
| 13 | /// # use embassy_futures::{block_on, yield_now}; | ||
| 14 | /// # async fn test_fn() { | ||
| 15 | /// # let mut iter_count: u32 = 0; | ||
| 16 | /// # let mut some_condition = || { iter_count += 1; iter_count > 10 }; | ||
| 13 | /// while !some_condition() { | 17 | /// while !some_condition() { |
| 14 | /// yield_now().await; | 18 | /// yield_now().await; |
| 15 | /// } | 19 | /// } |
| 20 | /// # } | ||
| 21 | /// # block_on(test_fn()); | ||
| 16 | /// ``` | 22 | /// ``` |
| 17 | /// | 23 | /// |
| 18 | /// The downside is this will spin in a busy loop, using 100% of the CPU, while | 24 | /// The downside is this will spin in a busy loop, using 100% of the CPU, while |
