Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/sync_placeholder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,20 @@ impl<
let new_waker = cx.waker();
if !waker.will_wake(new_waker) {
let mut state = shared.state.write();
// Re-check notified after acquiring the lock. A concurrent
// insert may have drained the waiters list between the
// notified check in the match guard above and this point.
if this.notified.load(Ordering::Acquire) {
drop(state);
let JoinFutureState::Pending { shared, .. } =
mem::replace(&mut this.state, JoinFutureState::Done)
else {
unsafe { unreachable_unchecked() }
};
return Poll::Ready(PlaceholderGuard::handle_notification(
lifecycle, shard, shared,
));
}
if let Some(w) = state
.waiters
.iter_mut()
Expand Down