Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid pinning notified future #3098

Merged
Prev Previous commit
feedback
Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
zaharidichev committed Nov 15, 2020
commit 8f3d853ae207a9f12bfcf1d16ff3fe6914d5ab64
6 changes: 3 additions & 3 deletions tokio/src/sync/notify.rs
Original file line number Diff line number Diff line change
@@ -109,8 +109,8 @@ type WaitList = LinkedList<Waiter, <Waiter as linked_list::Link>::Target>;
/// [`Semaphore`]: crate::sync::Semaphore
#[derive(Debug)]
pub struct Notify {
// this uses 2 bits to store one of `EMPTY`,
// `WAITING` or "NOTIFIED". The rest of the bits
// This uses 2 bits to store one of `EMPTY`,
// `WAITING` or `NOTIFIED`. The rest of the bits
// are used to store the number of times `notify_waiters`
// was called.
state: AtomicUsize,
@@ -427,7 +427,7 @@ impl Notify {

drop(waiters);

for waker in wakers.iter_mut().take(curr) {
for waker in wakers.iter_mut().take(curr_waker) {
waker.take().unwrap().wake();
}