Use Drop instead of destroy() for locks.

This commit is contained in:
Mara Bos 2022-06-03 16:45:47 +02:00
parent fb1976011e
commit ac5aa1ded5
24 changed files with 39 additions and 87 deletions

View file

@ -117,8 +117,6 @@ impl Condvar {
unsafe { mutex.lock() };
success
}
pub unsafe fn destroy(&self) {}
}
mod waiter_queue {

View file

@ -64,8 +64,10 @@ impl Mutex {
}
}
}
}
pub unsafe fn destroy(&self) {
impl Drop for Mutex {
fn drop(&mut self) {
if let Some(mtx) = self.mtx.get().map(|x| x.0) {
expect_success_aborting(unsafe { abi::del_mtx(mtx) }, &"del_mtx");
}