Skip to content
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

Add Handle::block_on method #2437

Merged
merged 2 commits into from Apr 24, 2020
Merged

Conversation

danburkert
Copy link
Contributor

Motivation

Adds the Handle::block_on, which is useful in synchronous contexts that only have shared access to the runtime, such as entry methods in a dynamic library.

Solution

I'm not confident in the implementation here, it's based on some guidance from @carllerche on discord, but I don't understand it myself. Basic tests are provided, happy to add more with guidance.

Copy link
Member

@carllerche carllerche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks 👍

@vorot93 vorot93 merged commit d8139fe into tokio-rs:master Apr 24, 2020
@danburkert danburkert deleted the handle-block-on branch April 24, 2020 15:25
Darksonn added a commit that referenced this pull request Apr 24, 2020
@Darksonn Darksonn added A-tokio Area: The main tokio crate C-enhancement Category: A PR with an enhancement or bugfix. M-runtime Module: tokio/runtime labels Apr 29, 2020
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-runtime Module: tokio/runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants