Closed sunfishcode closed 2 years ago
Thank you!
A convenient feature of parking_lot
was its ability to easily trace dead locks. Is it something that can also be done with std::sync::Mutex
?
Unfortunately no, I don't believe std::sync::Mutex
has that feature.
As of Rust 1.62,
std::sync::Mutex
is much faster and doesn't require dynamic allocation.Also, it supports poisoning (see the added
.unwrap()
calls), which means that if one thread panics while holding a locked mutex, other threads trying to unlock the mutex will also panic, rather than silently acquiring the lock. This gives applications a better chance of safely shutting down in the event of a panic.