aboutsummaryrefslogtreecommitdiff
path: root/examples/nrf52840/src/bin/self_spawn_current_executor.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2025-07-09 01:49:31 +0200
committerdiondokter <[email protected]>2025-08-29 13:23:21 +0200
commit8aec341f28a00012e1771d5c35d2647e11830755 (patch)
tree28ec3bad05e5dcb6ec949493688111839bb6865b /examples/nrf52840/src/bin/self_spawn_current_executor.rs
parent34ff67cdbf25e278ff99bd4a05b6b8c6a30fa5d1 (diff)
executor: return error when creating the spawntoken, not when spawning.
Diffstat (limited to 'examples/nrf52840/src/bin/self_spawn_current_executor.rs')
-rw-r--r--examples/nrf52840/src/bin/self_spawn_current_executor.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/nrf52840/src/bin/self_spawn_current_executor.rs b/examples/nrf52840/src/bin/self_spawn_current_executor.rs
index ddb40dc53..d93067592 100644
--- a/examples/nrf52840/src/bin/self_spawn_current_executor.rs
+++ b/examples/nrf52840/src/bin/self_spawn_current_executor.rs
@@ -11,12 +11,12 @@ async 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 let spawner = unsafe { Spawner::for_current_executor().await }; 13 let spawner = unsafe { Spawner::for_current_executor().await };
14 unwrap!(spawner.spawn(my_task(n + 1))); 14 spawner.spawn(unwrap!(my_task(n + 1)));
15} 15}
16 16
17#[embassy_executor::main] 17#[embassy_executor::main]
18async fn main(spawner: Spawner) { 18async fn main(spawner: Spawner) {
19 let _p = embassy_nrf::init(Default::default()); 19 let _p = embassy_nrf::init(Default::default());
20 info!("Hello World!"); 20 info!("Hello World!");
21 unwrap!(spawner.spawn(my_task(0))); 21 spawner.spawn(unwrap!(my_task(0)));
22} 22}