Skip to content

Commit

Permalink
Handle RwLock reader count overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanieu committed Aug 5, 2016
1 parent 4c02363 commit dff62c1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/libstd/sys/unix/rwlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ impl RWLock {
// 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();
}
Expand Down

0 comments on commit dff62c1

Please sign in to comment.