Skip to content

Commit dff62c1

Browse files
committed
Handle RwLock reader count overflow
1 parent 4c02363 commit dff62c1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/libstd/sys/unix/rwlock.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ impl RWLock {
5050
// the implementation allows recursive locking. The POSIX standard
5151
// doesn't require recursivly locking a rwlock to deadlock, but we can't
5252
// allow that because it could lead to aliasing issues.
53-
if r == libc::EDEADLK || *self.write_locked.get() {
53+
if r == libc::EAGAIN {
54+
panic!("rwlock maximum reader count exceeded");
55+
} else if r == libc::EDEADLK || *self.write_locked.get() {
5456
if r == 0 {
5557
self.raw_unlock();
5658
}

0 commit comments

Comments
 (0)