Lock Poisoning in Rust
Lock poisoning occurs when a thread panics while holding a Mutex or Reader-Writer Lock.
Subsequent attempts to acquire the lock for read or write will return an error indicating the lock is poisoned. The lock still behaves as it should by putting other threads to sleep, but signals that the protected state may be invalid.
The call to unwrap at the end of each lock call should tell you the locking operation returns a Result type. If a thread panics while holding the lock, subsequent calls to lock for read and write will result in errors. The lock still behaves as it should, i.e. putting other threads to sleep, but no data will be returned from the lock.
