diff options
author | laizy <laizy@users.noreply.github.com> | 2019-11-20 21:55:50 +0800 |
---|---|---|
committer | Stjepan Glavina <stjepang@gmail.com> | 2019-11-20 14:55:50 +0100 |
commit | 2b0427a6cf49f14faf675d023bbcdec590cde1af (patch) | |
tree | bbb3b5187f9e675b0d0d5a7a33f14e873df37227 | |
parent | 5c398cfa74092510d061148ef01ce1a3ded85916 (diff) | |
download | async-task-2b0427a6cf49f14faf675d023bbcdec590cde1af.tar.gz |
remove one notify_unless call (#9)
* remove one notify_unless call
* update comments
* Update src/join_handle.rs
Co-Authored-By: Stjepan Glavina <stjepang@gmail.com>
-rw-r--r-- | src/join_handle.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/join_handle.rs b/src/join_handle.rs index bd9366f..bd6f8c7 100644 --- a/src/join_handle.rs +++ b/src/join_handle.rs @@ -206,11 +206,10 @@ impl<R, T> Future for JoinHandle<R, T> { // 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`. + // If the task has been closed, return `None`. We do not need to notify the + // awaiter here, since we have replaced the waker above, and the executor can + // only set it back to `None`. if state & CLOSED != 0 { - // Even though the awaiter is most likely the current task, it could also - // be another task. - (*header).notify_unless(cx.waker()); return Poll::Ready(None); } |