aboutsummaryrefslogtreecommitdiff
path: root/embassy-executor
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-executor')
-rw-r--r--embassy-executor/src/spawner.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/embassy-executor/src/spawner.rs b/embassy-executor/src/spawner.rs
index 41320d4c3..ce24589bf 100644
--- a/embassy-executor/src/spawner.rs
+++ b/embassy-executor/src/spawner.rs
@@ -1,4 +1,4 @@
1use core::future::poll_fn; 1use core::future::{poll_fn, Future};
2use core::marker::PhantomData; 2use core::marker::PhantomData;
3use core::mem; 3use core::mem;
4use core::sync::atomic::Ordering; 4use core::sync::atomic::Ordering;
@@ -100,7 +100,7 @@ impl Spawner {
100 /// # Panics 100 /// # Panics
101 /// 101 ///
102 /// Panics if the current executor is not an Embassy executor. 102 /// Panics if the current executor is not an Embassy executor.
103 pub async fn for_current_executor() -> Self { 103 pub fn for_current_executor() -> impl Future<Output = Self> {
104 poll_fn(|cx| { 104 poll_fn(|cx| {
105 let task = raw::task_from_waker(cx.waker()); 105 let task = raw::task_from_waker(cx.waker());
106 let executor = unsafe { 106 let executor = unsafe {
@@ -113,7 +113,6 @@ impl Spawner {
113 let executor = unsafe { raw::Executor::wrap(executor) }; 113 let executor = unsafe { raw::Executor::wrap(executor) };
114 Poll::Ready(Self::new(executor)) 114 Poll::Ready(Self::new(executor))
115 }) 115 })
116 .await
117 } 116 }
118 117
119 /// Spawn a task into an executor. 118 /// Spawn a task into an executor.
@@ -178,7 +177,7 @@ impl SendSpawner {
178 /// # Panics 177 /// # Panics
179 /// 178 ///
180 /// Panics if the current executor is not an Embassy executor. 179 /// Panics if the current executor is not an Embassy executor.
181 pub async fn for_current_executor() -> Self { 180 pub fn for_current_executor() -> impl Future<Output = Self> {
182 poll_fn(|cx| { 181 poll_fn(|cx| {
183 let task = raw::task_from_waker(cx.waker()); 182 let task = raw::task_from_waker(cx.waker());
184 let executor = unsafe { 183 let executor = unsafe {
@@ -190,7 +189,6 @@ impl SendSpawner {
190 }; 189 };
191 Poll::Ready(Self::new(executor)) 190 Poll::Ready(Self::new(executor))
192 }) 191 })
193 .await
194 } 192 }
195 193
196 /// Spawn a task into an executor. 194 /// Spawn a task into an executor.