Skip to content

Conversation

@laizy
Copy link
Contributor

@laizy laizy commented Nov 18, 2019

Header::awaiter can only be changed with Header::swap_awaiter, which only be called in three places.
swap_awaiter(None) in two places, and one in function JoinHandle::poll at line 202. since JoinHandle::poll will not called concurrently, at line 211 we can conclude that Header::awaiter must be cx.waker() (set at line 202) or None(set by other thread). so call notify_unless will have no effects, and can be removed.

// completed or closed just before registration so we need to check for that.
state = (*header).state.load(Ordering::Acquire);

// If the task has been closed, notify the awaiter and return `None`.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also update this comment to reflect the change?

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Co-Authored-By: Stjepan Glavina <stjepang@gmail.com>
@ghost ghost merged commit 2b0427a into async-rs:master Nov 20, 2019
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant