aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy/src/executor/raw/mod.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/embassy/src/executor/raw/mod.rs b/embassy/src/executor/raw/mod.rs
index 5cf399cdf..fb6a55611 100644
--- a/embassy/src/executor/raw/mod.rs
+++ b/embassy/src/executor/raw/mod.rs
@@ -164,14 +164,14 @@ impl<F: Future + 'static> TaskStorage<F> {
164 /// Once the task has finished running, you may spawn it again. It is allowed to spawn it 164 /// Once the task has finished running, you may spawn it again. It is allowed to spawn it
165 /// on a different executor. 165 /// on a different executor.
166 pub fn spawn(&'static self, future: impl FnOnce() -> F) -> SpawnToken<impl Sized> { 166 pub fn spawn(&'static self, future: impl FnOnce() -> F) -> SpawnToken<impl Sized> {
167 if self.spawn_allocate() { 167 if self.spawn_mark_used() {
168 unsafe { SpawnToken::<F>::new(self.spawn_initialize(future)) } 168 unsafe { SpawnToken::<F>::new(self.spawn_initialize(future)) }
169 } else { 169 } else {
170 SpawnToken::<F>::new_failed() 170 SpawnToken::<F>::new_failed()
171 } 171 }
172 } 172 }
173 173
174 fn spawn_allocate(&'static self) -> bool { 174 fn spawn_mark_used(&'static self) -> bool {
175 let state = STATE_SPAWNED | STATE_RUN_QUEUED; 175 let state = STATE_SPAWNED | STATE_RUN_QUEUED;
176 self.raw 176 self.raw
177 .state 177 .state
@@ -234,7 +234,7 @@ impl<F: Future + 'static, const N: usize> TaskPool<F, N> {
234 /// which will cause [`Spawner::spawn()`] to return the error. 234 /// which will cause [`Spawner::spawn()`] to return the error.
235 pub fn spawn(&'static self, future: impl FnOnce() -> F) -> SpawnToken<impl Sized> { 235 pub fn spawn(&'static self, future: impl FnOnce() -> F) -> SpawnToken<impl Sized> {
236 for task in &self.pool { 236 for task in &self.pool {
237 if task.spawn_allocate() { 237 if task.spawn_mark_used() {
238 return unsafe { SpawnToken::<F>::new(task.spawn_initialize(future)) }; 238 return unsafe { SpawnToken::<F>::new(task.spawn_initialize(future)) };
239 } 239 }
240 } 240 }
@@ -282,7 +282,7 @@ impl<F: Future + 'static, const N: usize> TaskPool<F, N> {
282 // by the user, with arbitrary hand-implemented futures. This is why these return `SpawnToken<F>`. 282 // by the user, with arbitrary hand-implemented futures. This is why these return `SpawnToken<F>`.
283 283
284 for task in &self.pool { 284 for task in &self.pool {
285 if task.spawn_allocate() { 285 if task.spawn_mark_used() {
286 return SpawnToken::<FutFn>::new(task.spawn_initialize(future)); 286 return SpawnToken::<FutFn>::new(task.spawn_initialize(future));
287 } 287 }
288 } 288 }