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

Add sync_scope for LocalKey #3612

Merged
merged 1 commit into from Mar 22, 2021
Merged

Add sync_scope for LocalKey #3612

merged 1 commit into from Mar 22, 2021

Conversation

quininer
Copy link
Member

Motivation

In some cases, async/await cannot be used, but we want to access LocalKey.

Solution

We add a scope_in_place method to make it support closures.

@Darksonn Darksonn added A-tokio Area: The main tokio crate M-task Module: tokio/task labels Mar 12, 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.

This seems like a reasonable feature, but I don't think scope_in_place is a super good name?

@quininer
Copy link
Member Author

I agree that scope_in_place is not a good name, do you have any suggestions?

@Darksonn
Copy link
Contributor

One suggestion might be sync_scope, but it isn't great.

@quininer quininer changed the title Add scope_in_place for LocalKey Add sync_scope for LocalKey Mar 22, 2021
@Darksonn Darksonn merged commit c659e4a into tokio-rs:master Mar 22, 2021
@quininer quininer deleted the patch-2 branch March 22, 2021 16:11
@Darksonn Darksonn mentioned this pull request Apr 12, 2021
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.

None yet

2 participants