4 ms·
> (you can use try_lock to recover from them) Slightly inaccurate. You can recover from them with `lock` too. In fact, to _not_ attempt to recover from them, y
by School-Cotton 4y ago
> (you can use try_lock to recover from them)
Slightly inaccurate. You can recover from them with `lock` too. In fact, to _not_ attempt to recover from them, your code should have looked like:
let shared = self.shared.lock().expect("mutex poisoned!")
as `lock` returns a `Result`.
The difference between `try_lock` and `lock` is unrelated: `try_lock` fails fast if it's not possible to take the mutex immediately.