-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(maitake): handle spurious
WaitCell
polls (#453)
This branch changes the `Wait` future for `maitake::sync::WaitCell` to handle spurious polls correctly. Currently, a `wait_cell::Wait` future assumes that if it's ever polled a second time, that means its waker was woken. However, there might be other reasons that a stack of futures containing a `Wait` is polled again, and the `Wait` future will incorrectly complete immediately in that case. This branch fixes this by replacing the `bool` field in `Wait` that's set on first poll with an additional bit stored in the `WaitCell`'s state field. This is set when the cell is actually woken, and only unset by the `Wait` future when it's polled. If the `WOKEN` bit was set, the `Wait` future completes, and if it was unset, the future re-registers itself. This way, the `Wait` future only completes if it was *woken by the waitcell*, rather than on *any* poll if the task was woken by something else. Fixes #449
- Loading branch information
Showing
1 changed file
with
35 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters