You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What I like about the current behavior is that smol::run() is fully self-contained and does cleanup at the end of its invocation. That means no tasks will be "leaked" for the next invocation of smol::run() or until the thread exits.
Do you have a particular use case for the behavior proposed in this PR?
What I like about the current behavior is that smol::run() is fully self-contained and does cleanup at the end of its invocation. That means no tasks will be "leaked" for the next invocation of smol::run() or until the thread exits.
I didn't thought of that. I edited my commit to not use thread_local. Now I create LocalExecutor within closures.
Do you have a particular use case for the behavior proposed in this PR?
Yes, and it is very difficult to guarantee that Task::local is called on the main thread.
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
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 enables us to use
Task::localfrom any thread, this is how smol 0.1 behavior was.We achieve this by having a thread local
LocalExecutor.The following is now possible:
This commit needs smol-rs/async-executor#4, so CI will fail.