impl downgrade

This commit is contained in:
Joel Wejdenstål 2022-05-28 13:15:06 +02:00
parent 93ce0dcf8b
commit 3329a89a8e
No known key found for this signature in database
GPG Key ID: DF03CEFBB1A915AA
1 changed files with 6 additions and 1 deletions

View File

@ -76,7 +76,12 @@ unsafe impl lock_api::RawRwLock for RawRwLock {
unsafe impl lock_api::RawRwLockDowngrade for RawRwLock {
#[inline]
unsafe fn downgrade(&self) {
todo!()
let state = self
.state
.fetch_and(ONE_READER | WRITERS_PARKED, Ordering::Release);
if state & READERS_PARKED != 0 {
parking_lot_core::unpark_all((self as *const _ as usize) + 1, UnparkToken(0));
}
}
}