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

OwnedMutexGuard is missing a mapped version #5414

Closed
craftytrickster opened this issue Jan 30, 2023 · 4 comments · Fixed by #5474
Closed

OwnedMutexGuard is missing a mapped version #5414

craftytrickster opened this issue Jan 30, 2023 · 4 comments · Fixed by #5474
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request. E-help-wanted Call for participation: Help is requested to fix this issue. M-sync Module: tokio/sync

Comments

@craftytrickster
Copy link
Contributor

I would like for .map to exist on the OwnedMutexGuard the same way it currently exists on MutexGuard.

@craftytrickster craftytrickster added A-tokio Area: The main tokio crate C-feature-request Category: A feature request. labels Jan 30, 2023
@Darksonn Darksonn added E-help-wanted Call for participation: Help is requested to fix this issue. M-sync Module: tokio/sync labels Jan 31, 2023
@Darksonn
Copy link
Contributor

We've had soundness issues due to mapping mutex guards in the past (see e.g. #2472, #3344), so I would like to first verify that this addition is sound.

@Amanieu Do you know whether there is any issue with adding a method for mapping on our owned mutex guard? We already have it on the non-owned guard.

@Amanieu
Copy link

Amanieu commented Jan 31, 2023

OwnedMutexGuard::mutex gives access to the original Arc<Mutex<T>>, which won't work after mapping. So you do need a separate type.

@Darksonn
Copy link
Contributor

Ok, that makes sense. We will go for a new separate type.

@Darksonn
Copy link
Contributor

I figured out why we don't already have this: it's super annoying to implement.

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 C-feature-request Category: A feature request. E-help-wanted Call for participation: Help is requested to fix this issue. M-sync Module: tokio/sync
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants