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.
While exploring the possibility of making the concrete implementation of the current thread executor pluggable, I started to have doubts regarding the daemon task concept and the global function to cancel all running futures.
While at first, they seemed good, I now consider that functionality slightly misplaced. Specifically, both daemon tasks and cancelling running tasks fall within the category of shutdown strategies. IMO the process of shutting down should be controlled by the application and not be something that libraries (future aware libraries, not futures-rs itself) is concerned about.
As such, it didn't seem appropriate for this functionality to be available at a global function level.
I couldn't think of any concrete use case that was best served by a daemon future concept. For example, when using the h2 library, there is a need to spawn "worker" tasks. However, these would never be spawned as a daemon task. Instead, the worker task processes work as it receives it. Work is submitted by "top level" tasks over a handle. The worker task knows when to shutdown by observing that all handles drop.
It could very well be that I am wrong and that the daemon task strategy is correct and all executors should provide this functionality. However, in the effort to remain conservative and actually ship something, I propose:
Both of these can be added at a later time, especially as future releases are planed.