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

Bring Back shutdown_on_idle #1957

Closed
asevans48 opened this issue Dec 13, 2019 · 3 comments
Closed

Bring Back shutdown_on_idle #1957

asevans48 opened this issue Dec 13, 2019 · 3 comments

Comments

@asevans48
Copy link

0.2.4

Windows 10 and Ubuntu 18.04 lts

Description

Shutdown on idle is now removed from the API. It is nice to have to be able to gracefully shutdown the system on a custom runtime. Can it be added back in?

@hawkw
Copy link
Member

hawkw commented Dec 14, 2019

In tokio 0.2, tokio::spawn returns a JoinHandle. You can now use those JoinHandles to await the termination of spawned tasks in block_on, allowing more granular control over what futures keep the runtime running without requiring the runtime to track global idleness (which introduces overhead).

@carllerche
Copy link
Member

#1879 is tracking a replacement. Until them what @hawkw said works.

@tyranron
Copy link

tyranron commented Aug 16, 2020

@carllerche #1879 is closed 😕
What about this one, can it be reconsidered?

The soultion provided by @hawkw doesn't work well in a common case, sometimes leading to very scary hacks when we need to pass those JoinHandles around via some global state.

The most common example when we need some notion of AsyncDrop, which we do today as Drop + tokio::spawn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants