eio_linux: allow alloc_fixed_or_wait to be cancelled #753
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As noted in #752, waiting for a fixed buffer couldn't be cancelled. This adds support for that.
I'm using this PR to test out the Picos style of cancellation. Normally, Eio programs set a cancel function to be invoked immediately when the fiber is cancelled, but Picos instead just schedules the cancelled fiber to be resumed and the clean-up actions happen later.
The new style introduces an annoying extra state, where the operation is half-cancelled (the cancellation has happened, but the fiber is still registered as waiting for a buffer), and we need to handle that by retrying. On the other hand, it means no user code runs in the scheduler's context, and potentially allows cancellation from another domain.