-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Be more principled about when blocking is ok #2410
Merged
Merged
Conversation
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
This enables `block_in_place` to be used in more contexts. Specifically, it allows you to block whenever you are off the tokio runtime (like if you are not using tokio, are in a `spawn_blocking` closure, etc.), and in the threaded scheduler's `block_on`. Blocking in `LocalSet` and the basic scheduler's` block_on` is still disallowed. Fixes #2327.
jonhoo
force-pushed
the
more-block-in-place
branch
from
April 16, 2020 21:20
ffbbc4b
to
3ca4a19
Compare
jonhoo
added
C-enhancement
Category: A PR with an enhancement or bugfix.
finish-line
A-tokio
Area: The main tokio crate
M-blocking
Module: tokio/task/blocking
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
and removed
E-finish-line
labels
Apr 17, 2020
carllerche
approved these changes
Apr 20, 2020
Darksonn
removed
the
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
label
Apr 21, 2020
jonhoo
added a commit
to mit-pdos/noria
that referenced
this pull request
Apr 25, 2020
tokio-rs/tokio#2409 and tokio-rs/tokio#2410 have now been released.
jgrund
added a commit
to jgrund/tokio-diesel
that referenced
this pull request
May 20, 2020
Use `task::block_in_place` with allows a number of `'static` lifetimes to be removed. This now works outside a task spawn due to tokio-rs/tokio#2410 with the restriction that a threaded runtime is used. Fixes mehcode#9. Signed-off-by: Joe Grund <jgrund@whamcloud.io>
jgrund
added a commit
to jgrund/tokio-diesel
that referenced
this pull request
May 20, 2020
Use `task::block_in_place` with allows a number of `'static` lifetimes to be removed. This now works outside a task spawn due to tokio-rs/tokio#2410 with the restriction that a threaded runtime is used. Fixes mehcode#9. Signed-off-by: Joe Grund <jgrund@whamcloud.io>
jgrund
added a commit
to jgrund/tokio-diesel
that referenced
this pull request
May 20, 2020
Use `task::block_in_place` with allows a number of `'static` lifetimes to be removed. This now works outside a task spawn due to tokio-rs/tokio#2410 with the restriction that a threaded runtime is used. Fixes mehcode#9. Signed-off-by: Joe Grund <jgrund@whamcloud.io>
jgrund
added a commit
to jgrund/tokio-diesel
that referenced
this pull request
May 20, 2020
Use `task::block_in_place` with allows a number of `'static` lifetimes to be removed. This now works outside a task spawn due to tokio-rs/tokio#2410 with the restriction that a threaded runtime is used. Fixes mehcode#9. Signed-off-by: Joe Grund <jgrund@whamcloud.io>
jgrund
added a commit
to jgrund/tokio-diesel
that referenced
this pull request
May 20, 2020
Use `task::block_in_place` with allows a number of `'static` lifetimes to be removed. This now works outside a task spawn due to tokio-rs/tokio#2410 with the restriction that a threaded runtime is used. Fixes mehcode#9. Signed-off-by: Joe Grund <jgrund@whamcloud.io>
jgrund
added a commit
to jgrund/tokio-diesel
that referenced
this pull request
May 20, 2020
Use `task::block_in_place` with allows a number of `'static` lifetimes to be removed. This now works outside a task spawn due to tokio-rs/tokio#2410 with the restriction that a threaded runtime is used. Fixes mehcode#9. Signed-off-by: Joe Grund <jgrund@whamcloud.io>
jgrund
added a commit
to jgrund/tokio-diesel
that referenced
this pull request
May 20, 2020
Use `task::block_in_place` with allows a number of `'static` lifetimes to be removed. This now works outside a task spawn due to tokio-rs/tokio#2410 with the restriction that a threaded runtime is used. Fixes mehcode#9. Signed-off-by: Joe Grund <jgrund@whamcloud.io>
jgrund
added a commit
to jgrund/tokio-diesel
that referenced
this pull request
May 20, 2020
Use `task::block_in_place` with allows a number of `'static` lifetimes to be removed. This now works outside a task spawn due to tokio-rs/tokio#2410 with the restriction that a threaded runtime is used. I've also added in github actions to ensure this change works (and continues to) :) . Fixes mehcode#9. Signed-off-by: Joe Grund <jgrund@whamcloud.io>
mehcode
pushed a commit
to mehcode/tokio-diesel
that referenced
this pull request
Jun 10, 2020
Use `task::block_in_place` with allows a number of `'static` lifetimes to be removed. This now works outside a task spawn due to tokio-rs/tokio#2410 with the restriction that a threaded runtime is used. I've also added in github actions to ensure this change works (and continues to) :) . Fixes #9. Signed-off-by: Joe Grund <jgrund@whamcloud.io>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-tokio
Area: The main tokio crate
C-enhancement
Category: A PR with an enhancement or bugfix.
M-blocking
Module: tokio/task/blocking
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
block_in_place
to be used in more contexts. Specifically,it allows you to block whenever you are off the tokio runtime (like if
you are not using tokio, are in a
spawn_blocking
closure, etc.), andin the threaded scheduler's
block_on
. Blocking inLocalSet
and thebasic scheduler's
block_on
is still disallowed.Fixes #2327.
Fixes #2393.