aboutsummaryrefslogtreecommitdiff
path: root/examples/nrf52840/src
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2025-07-08 22:39:53 +0200
committerDario Nieuwenhuis <[email protected]>2025-07-08 22:39:53 +0200
commit0c136c7b050ded4bf660ea7a50381698ab9d5f09 (patch)
tree5441615f6a9bd0cbe9e26d949999be6dc6e9e778 /examples/nrf52840/src
parent08c033ae2ea0a47ccb0e8c60938f63ca4df9a18a (diff)
executor: mark Spawner::for_current_executor() as unsafe.
It's unsound with manually-created Contexts, see https://github.com/embassy-rs/embassy/issues/4379
Diffstat (limited to 'examples/nrf52840/src')
-rw-r--r--examples/nrf52840/src/bin/self_spawn_current_executor.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/nrf52840/src/bin/self_spawn_current_executor.rs b/examples/nrf52840/src/bin/self_spawn_current_executor.rs
index ec9569a64..ddb40dc53 100644
--- a/examples/nrf52840/src/bin/self_spawn_current_executor.rs
+++ b/examples/nrf52840/src/bin/self_spawn_current_executor.rs
@@ -10,7 +10,8 @@ use {defmt_rtt as _, panic_probe as _};
10async fn my_task(n: u32) { 10async fn my_task(n: u32) {
11 Timer::after_secs(1).await; 11 Timer::after_secs(1).await;
12 info!("Spawning self! {}", n); 12 info!("Spawning self! {}", n);
13 unwrap!(Spawner::for_current_executor().await.spawn(my_task(n + 1))); 13 let spawner = unsafe { Spawner::for_current_executor().await };
14 unwrap!(spawner.spawn(my_task(n + 1)));
14} 15}
15 16
16#[embassy_executor::main] 17#[embassy_executor::main]