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

Enhancement: is mutex poisoning a worthwhile feature for a std mutex compatible version #324

Open
tttwang23 opened this issue Mar 5, 2022 · 3 comments

Comments

@tttwang23
Copy link

Rust standard libray's version of Mutex has a useful feature of mutex poisoning. If a mutex owning thread panics, then the mutex is marked as poisoned so that other threads could balk and prepare for app shutdown.

Is there value to provide a parking_lot styled mutex implementation that also have this poisoning feature?

@Amanieu
Copy link
Owner

Amanieu commented Mar 5, 2022

I strongly believe that mutex poisoning is an anti-feature: it hurts usability and reliability. The only reason is it kept in the standard library is because this feature is already stable and cannot be removed.

@tttwang23
Copy link
Author

Interesting; thanks!

@John-Nagle
Copy link

I'm in favor of mutex poisoning. When one thread has panicked, you don't want other threads advancing into crashed state while you're trying to shut everything down cleanly. Use case: GUI-type programs, where you may want to give the user a message on screen, save some state, and send in a crash report before exiting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants