-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
task: add
Builder::{spawn_on, spawn_local_on, spawn_blocking_on}
(#…
…4683) ## Motivation `task::JoinSet` currently has both `spawn`/`spawn_local` methods, and `spawn_on`/`spawn_local_on` variants of these methods that take a reference to a runtime `Handle` or to a `LocalSet`, and spawn tasks on the provided runtime/`LocalSet`, rather than the current one. The `task::Builder` type is _also_ an API type that can spawn tasks, but it doesn't have `spawn_on` variants of its methods. It occurred to me that it would be nice to have similar APIs on `task::Builder`. ## Solution This branch adds `task::Builder::spawn_on`, `task::Builder::spawn_local_on`, and `task::Builder::spawn_blocking_on` methods, similar to those on `JoinSet`. In addition, I did some refactoring of the internal spawning APIs --- there was a bit of duplicated code that this PR reduces. Signed-off-by: Eliza Weisman <[email protected]>
- Loading branch information
Showing
3 changed files
with
130 additions
and
34 deletions.
There are no files selected for viewing
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 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 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