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

@ -82,9 +82,11 @@ impl RwLock {
let rwl = self.raw();
expect_success_aborting(unsafe { abi::rwl_unl_rwl(rwl) }, &"rwl_unl_rwl");
}
}
impl Drop for RwLock {
#[inline]
pub unsafe fn destroy(&self) {
fn drop(&mut self) {
if let Some(rwl) = self.rwl.get().map(|x| x.0) {
expect_success_aborting(unsafe { abi::rwl_del_rwl(rwl) }, &"rwl_del_rwl");
}