We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9b8f902 commit 0c6a093Copy full SHA for 0c6a093
src/libstd/sys/unix/rwlock.rs
@@ -14,7 +14,7 @@ use sync::atomic::{AtomicUsize, Ordering};
14
15
pub struct RWLock {
16
inner: UnsafeCell<libc::pthread_rwlock_t>,
17
- write_locked: UnsafeCell<bool>,
+ write_locked: UnsafeCell<bool>, // guarded by the `inner` RwLock
18
num_readers: AtomicUsize,
19
}
20
@@ -52,7 +52,7 @@ impl RWLock {
52
// allow that because it could lead to aliasing issues.
53
if r == libc::EAGAIN {
54
panic!("rwlock maximum reader count exceeded");
55
- } else if r == libc::EDEADLK || *self.write_locked.get() {
+ } else if r == libc::EDEADLK || (r == 0 && *self.write_locked.get()) {
56
if r == 0 {
57
self.raw_unlock();
58
0 commit comments