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

tokio::spawn should have task names #2645

Open
Milo123459 opened this issue Sep 14, 2021 · 3 comments
Open

tokio::spawn should have task names #2645

Milo123459 opened this issue Sep 14, 2021 · 3 comments
Labels
B-upstream Blocked: needs a change in a dependency or the compiler. C-feature Category: feature. This is adding a new feature.

Comments

@Milo123459
Copy link

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Using the console, it would be nice if hyper had some task names
Describe the solution you'd like
A clear and concise description of what you want to happen.
Implement a custom function for spawning something with a named parameter. Here is some code I wrote up:

pub fn spawn_named<T>(
	name: &str,
	future: impl std::future::Future<Output = T> + Send + 'static,
) -> tokio::task::JoinHandle<T>
where
	T: Send + 'static,
{
	#[cfg(tokio_unstable)]
	return tokio::task::Builder::new().name(name).spawn(future);

	#[cfg(not(tokio_unstable))]
	tokio::spawn(future)
}

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
N/A
Additional context
Add any other context or screenshots about the feature request here.

@Milo123459 Milo123459 added the C-feature Category: feature. This is adding a new feature. label Sep 14, 2021
@seanmonstar
Copy link
Member

Yea, I get what you mean. Though, as long as it's unstable in Tokio, I don't think we'd add support yet. That said, it's easily possible to provide a hyper::rt::Executor that uses that instead of depending on hyper's default.

@Milo123459
Copy link
Author

Yea, I get what you mean. Though, as long as it's unstable in Tokio, I don't think we'd add support yet. That said, it's easily possible to provide a hyper::rt::Executor that uses that instead of depending on hyper's default.

I think we should prepare for the future, if you know what I mean. A few other libraries I use (serenity) have already implemented this and I think because serenity uses hyper, it'd be nice to see hyper implementing this as well.

@seanmonstar
Copy link
Member

Unsure, but you can check in on the stabilization issue here: tokio-rs/tokio#4114

@seanmonstar seanmonstar added the B-upstream Blocked: needs a change in a dependency or the compiler. label Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-upstream Blocked: needs a change in a dependency or the compiler. C-feature Category: feature. This is adding a new feature.
Projects
None yet
Development

No branches or pull requests

2 participants