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: wake localset on spawn_local #3369

Merged
merged 2 commits into from
Jan 9, 2021

Conversation

SkamDart
Copy link
Contributor

@SkamDart SkamDart commented Jan 3, 2021

Wake the tokio::task::LocalSet after
tokio::task::LocalSet::spawn_local is called.

Note this side effect in the tokio::task::LocalSet::spawn_local docs.

Add test for spawn_local being woke in task_local_set.rs

Fixes: #3117

Motivation

Fixes #3117

Solution

Add call to shared waker in localset after adding future to localset task queue.

Wake the `tokio::task::LocalSet` after
`tokio::task::LocalSet::spawn_local` is called.

Note this side effect in the `tokio::task::LocalSet::spawn_local` docs.

Add test for spawn_local being woke in `task_local_set.rs`

Fixes: tokio-rs#3117
@Darksonn Darksonn added A-tokio Area: The main tokio crate M-task Module: tokio/task labels Jan 3, 2021
Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment on lines 245 to 246
/// Calls to this function will result in waking the current localset.
///
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is necessary to have in the doc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to remove it if you don't think it is necessary. I added it because a side effect that changes program behavior is worth noting imo.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is necessary. The "wake" is an implementation detail.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides, notes about changes in behavior go in the changelog instead. (You don't have to put it in this PR, we do them together when making the release.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense - Thanks for the review! Pushed the suggested changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-task Module: tokio/task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hang with LocalSet
3 participants