Skip to content

Commit a4cce12

Browse files
paulip1792taiki-e
authored andcommitted
perf: improve AtomicWaker::wake performance (#2983)
1 parent ba9d102 commit a4cce12

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

futures-core/src/task/__internal/atomic_waker.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,8 @@ impl AtomicWaker {
385385
let waker = unsafe { (*self.waker.get()).take() };
386386

387387
// Release the lock
388-
self.state.fetch_and(!WAKING, Release);
388+
let old_state = self.state.swap(WAITING, Release);
389+
debug_assert!(old_state == WAKING);
389390

390391
waker
391392
}

0 commit comments

Comments
 (0)