Open
Conversation
502df3e to
dfc009f
Compare
dfc009f to
20cef96
Compare
f8e5880 to
5361648
Compare
5361648 to
161e485
Compare
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.
This enables big performance improvements by not having to clone elements for
ParallelStreams.The complication is that, akin to
crossbeam::scope, we need to block before returning to avoid the usermem::forgetting the handle and mutating the data while other threads still have a reference to it. If we were sync (like for examplerayon) this wouldn't be much of an issue. As we're async and have to return whenever I/O blocks, this is harder to deal with.The current compromise in this PR is using
tokioto block the current task (when running under the multithreaded scheduler) or current thread (when running under the basic scheduler). This is unfortunately mildly surprising from a user POV. WIP.TODO:
ThreadPool::spawned futures (e.g. during.all()) to ack that they've been cancelled, to avoid returning while a task may be running on another thread that uses referenced dataSee also:
tokio-rs/tokio#1879 tokio-rs/tokio#2576 tokio-rs/tokio#2596 rust-lang/rfcs#2958 rmanoka/async-scoped
There are two issues:
JoinHandle::dropwe must block on this async cancellation. Prefer some sort of async drop as an optimisation to avoid the blocking.And a third: