in src/sync/rwlock.rs [227:248]
fn unblock_waiters(state: &RwLockState, me: TaskId, drop_type: RwLockType) {
for tid in state.waiting_readers.iter() {
debug_assert_ne!(tid, me);
ExecutionState::with(|s| {
let t = s.get_mut(tid);
debug_assert!(drop_type == RwLockType::Read || t.blocked());
t.unblock();
});
}
// Only unblock waiting writers if there are no exiting readers holding the lock
if state.holder == RwLockHolder::None {
for tid in state.waiting_writers.iter() {
debug_assert_ne!(tid, me);
ExecutionState::with(|s| {
let t = s.get_mut(tid);
debug_assert!(t.blocked());
t.unblock();
});
}
}
}