Repository navigation
Add exclusive file close and bounded cleanup submission. - #29
Merged
Merged
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add explicit
file_close(file).awaitandfile_close_submit(file).await, with a commented example showing how to request cancellation, await the outstanding operation, and then close safely.Both methods consume exclusive ownership. Concrete backends now expose a non-clonable
FileHandleinstead ofArc<std::fs::File>; backend operations retain private ownership until they finish. Closing while an abandoned operation still retains the file panics, without interrupting that operation or introducing a per-file registry. Backend resource references are released before completion wakes the caller.Close waits for bounded admission and reports execution errors. The
_submitvariant waits only for admission and discards execution errors. Accepted jobs survive waiter abandonment and run on a separate cleanup pool; native shutdown outside workers and awaited Tokio shutdown drain them. Native destruction from a future or blocking-pool worker requests shutdown without waiting on its own work. All backends initially use blocking close syscalls; native io_uring close SQEs and CQE suppression remain future optimizations.The example in
crates/executor/examples/file_close.rsexplains shared cancellation handles, completion races, why dropping a future does not establish completion, and closing before propagating the read result. It runs against native and enabled Tokio backends. The design notes, simulator, and migration guidance reflect the new requiredFilemethods and resource type.