Skip to content

Commit d6e19ce

Browse files
committed
AtomicWaker: take and wake
1 parent 52e4c7c commit d6e19ce

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

embassy-executor/tests/test.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ fn waking_after_completion_does_not_poll() {
176176
"pend", // spawning a task pends the executor
177177
"poll task1", //
178178
"pend", // manual wake, gets cleared by poll
179-
"pend", // manual wake, single pend for two wakes
180179
"pend", // respawning a task pends the executor
181180
"poll task1", //
182181
]

embassy-sync/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
- AtomicWaker now drops the Waker after waking it.
11+
1012
## 0.6.2 - 2025-01-15
1113

1214
- Add dynamic dispatch variant of `Pipe`.

embassy-sync/src/waitqueue/atomic_waker.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@ impl<M: RawMutex> GenericAtomicWaker<M> {
3333
/// Wake the registered waker, if any.
3434
pub fn wake(&self) {
3535
self.waker.lock(|cell| {
36-
if let Some(w) = cell.replace(None) {
37-
w.wake_by_ref();
38-
cell.set(Some(w));
36+
if let Some(w) = cell.take() {
37+
w.wake();
3938
}
4039
})
4140
}

0 commit comments

Comments
 (0)