mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-17 05:25:37 +03:00
Handle RwLock reader count overflow
This commit is contained in:
@@ -50,7 +50,9 @@ pub unsafe fn read(&self) {
|
||||
// the implementation allows recursive locking. The POSIX standard
|
||||
// doesn't require recursivly locking a rwlock to deadlock, but we can't
|
||||
// allow that because it could lead to aliasing issues.
|
||||
if r == libc::EDEADLK || *self.write_locked.get() {
|
||||
if r == libc::EAGAIN {
|
||||
panic!("rwlock maximum reader count exceeded");
|
||||
} else if r == libc::EDEADLK || *self.write_locked.get() {
|
||||
if r == 0 {
|
||||
self.raw_unlock();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user