task: Add more tips + links to spawn_blocking docs#4150
Merged
Darksonn merged 2 commits intotokio-rs:masterfrom Oct 26, 2021
Merged
task: Add more tips + links to spawn_blocking docs#4150Darksonn merged 2 commits intotokio-rs:masterfrom
spawn_blocking docs#4150Darksonn merged 2 commits intotokio-rs:masterfrom
Conversation
f06a068 to
0f7b2cf
Compare
Darksonn
reviewed
Oct 4, 2021
Member
|
The CI failure is because your PR is written on top of an old master from May. |
Contributor
Author
|
OK I updated this and also added a link to the result from #4146 - so marking draft until that merges. |
0f7b2cf to
e2d1642
Compare
I'm working on some code which heavily uses `spawn_blocking` to run synchronous code, and it took me a while to find and understand the relevant APIs and patterns here. First, basically no real world case will spawn a closure that takes no parameters, so change the first example to pass an input value, mutate it, and receive the result. Let's link to the channel blocking APIs, and provide a small example of that too. This also mentions `SyncIoBridge` now.
e2d1642 to
0bacb79
Compare
Contributor
Author
|
OK rebased 🏄 and now links to the SyncIOBridge from #4146 Specifically related to this subthread - I would say that the existing bridging toplevel doc is actually mostly about the inverse case of creating a tokio runtime for a portion of a largely synchronous codebase, whereas the goal of this PR is to help explain how to use some synchronous code inside a largely asynchronous codebase. I created tokio-rs/website#621 to link back to this one. |
Darksonn
approved these changes
Oct 26, 2021
oliver-giersch
pushed a commit
to oliver-giersch/tokio
that referenced
this pull request
Oct 28, 2021
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.
I'm working on some code which heavily uses
spawn_blockingto run synchronous code, and it took me a while to find and understand
the relevant APIs and patterns here.
First, basically no real world case will spawn
a closure that takes no parameters, so
change the first example to pass an input value, mutate it, and
receive the result.
Let's link to the channel blocking APIs, and provide a small example
of that too.
This also mentions
SyncIoBridgenow.