feat(rt/tokio): introduce TokioHandleExecutor - #331
Merged
Merged
Conversation
cratelyn
force-pushed
the
kate/tokio-executors
branch
4 times, most recently
from
September 29, 2026 22:28
e1f4b08 to
058347d
Compare
cratelyn
marked this pull request as ready for review
September 29, 2026 22:28
cratelyn
marked this pull request as draft
September 30, 2026 21:00
Member
Author
|
rebasing now that #330 landed. |
see: https://github.com/tokio-rs/tokio/blob/master/tokio/CHANGELOG.md#1490-january-3rd-2026 this does not break hyper-util's MSRV, this tokio release supports 1.71 and newer. this release includes the stabilization of `tokio::runtime::Handle::id()`, which will permit us to write unit tests that inspect which runtime a spawned future is being run on. Signed-off-by: katelyn martin <git@katelyn.world>
this commit introduces an `hyper::rt::Executor` implementation, `TokioHandleExecutor`. this executor is used to run tasks on a tokio runtime, but spawns tasks onto a particular runtime using a provided `tokio::runtime::Handle` rather than by calling `tokio::spawn()` this is useful for situations in which you wish to run tasks on a *separate* runtime, for example. this may be applicable to those configuring hyper clients and servers in applications running on NUMA (Non-Uniform Memory Awareneses) systems, or those that wish to manage provision separate resources for background tasks. see the [`tokio::runtime`] documentation for more information about choosing the correct runtime for an application. a unit test is included which demonstrates that `TokioHandleExecutor` can be used to spawn background tasks onto a separate tokio runtime. [`tokio::runtime`]: https://docs.rs/tokio/latest/tokio/runtime/index.html#numa-awareness Signed-off-by: katelyn martin <git@katelyn.world>
cratelyn
force-pushed
the
kate/tokio-executors
branch
from
September 30, 2026 21:08
058347d to
eee3d23
Compare
cratelyn
marked this pull request as ready for review
September 30, 2026 21:13
HandleExecutorTokioHandleExecutor
seanmonstar
approved these changes
Oct 1, 2026
seanmonstar
left a comment
Member
There was a problem hiding this comment.
This looks fine to me. If you find there's a need, no problem.
dswij
approved these changes
Oct 1, 2026
dswij
left a comment
Member
There was a problem hiding this comment.
Thanks for the PR, looks great!
cratelyn
enabled auto-merge (squash)
October 2, 2026 16:20
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 commit introduces an
hyper::rt::Executorimplementation,HandleExecutor. this executor is used to run tasks on a tokio runtime, but spawns tasks onto a particular runtime using a providedtokio::runtime::Handlerather than by callingtokio::spawn()this is useful for situations in which you wish to run tasks on a separate runtime, for example. this may be applicable to those configuring hyper clients and servers in applications running on NUMA (Non-Uniform Memory Awareneses) systems, or those that wish to manage provision separate resources for background tasks. see the
tokio::runtimedocumentation for more information about choosing the correct runtime for an application.a unit test is included which demonstrates that
HandleExecutorcan be used to spawn background tasks onto a separate tokio runtime.this branch includes an update to the tokio dependency, bumping the verion from 1.13 to 1.49.
see: https://github.com/tokio-rs/tokio/blob/master/tokio/CHANGELOG.md#1490-january-3rd-2026
this does not break hyper-util's MSRV, this tokio release supports 1.71 and newer. this release includes the stabilization of
tokio::runtime::Handle::id(), which permit us to write unit tests that inspect which runtime a spawned future is being run on.