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

util: Add a TokioContext future #2776

Closed
LucioFranco opened this issue Aug 18, 2020 · 1 comment · Fixed by #2791
Closed

util: Add a TokioContext future #2776

LucioFranco opened this issue Aug 18, 2020 · 1 comment · Fixed by #2791
Labels
A-tokio-util Area: The tokio-util crate M-runtime Module: tokio/runtime

Comments

@LucioFranco
Copy link
Member

We should add a TokioContext future that takes some future F and a "handle" to the runtime (in tokio 0.2 this will be Handle and in tokio 0.3 this will be Runtime). It should then implement the Future trait when F: Future and will wrap each call to poll of the inner future with Handle::enter. This gist has an example implementation called TokioIo.

This should also live behind some feature flag in util, possibly rt-core since that will line up with the features flags in the main crate.

@LucioFranco LucioFranco added A-tokio-util Area: The tokio-util crate E-medium Call for participation: Experience needed to fix: Medium / intermediate labels Aug 18, 2020
@LucioFranco
Copy link
Member Author

Another, possible addition here would be to include the ability to take some runtime "handle" and have a method on it that will wrap it and output a future that can be spawned on other executors but still use the tokio context.

@LucioFranco LucioFranco added the M-runtime Module: tokio/runtime label Aug 18, 2020
blasrodri added a commit to blasrodri/tokio that referenced this issue Aug 24, 2020
Run a future on a custom executor using the tokio runtime.
Resolves: tokio-rs#2776
@Darksonn Darksonn removed the E-medium Call for participation: Experience needed to fix: Medium / intermediate label Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio-util Area: The tokio-util crate M-runtime Module: tokio/runtime
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants