Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix race condition that could lose a transfer completion wakup
If `poll_completion_generic` runs between `notify_completion`'s `waker.take()` and `state.swap(STATE_COMPLETED, ...)`, it could see the transfer as pending and register its waker, but that waker would never be called. This adds an Arc because once the transfer is set to `STATE_COMPLETED`, the other thread might free it, so we need to ensure the AtomicWaker stays alive while we use it. That's what the `take()` was intended to work around, but reading the waker before writing the status introduces the race.
- Loading branch information