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
-6
View File
@@ -55,9 +55,3 @@ pub unsafe fn wait_timeout(&self, mutex: &MovableMutex, dur: Duration) -> bool {
self.inner.wait_timeout(mutex.raw(), dur)
}
}
impl Drop for Condvar {
fn drop(&mut self) {
unsafe { self.inner.destroy() };
}
}
-6
View File
@@ -92,9 +92,3 @@ pub unsafe fn raw_unlock(&self) {
self.0.unlock()
}
}
impl Drop for MovableMutex {
fn drop(&mut self) {
unsafe { self.0.destroy() };
}
}
-7
View File
@@ -168,13 +168,6 @@ unsafe fn increment_lock_count(&self) {
}
}
impl<T> Drop for ReentrantMutex<T> {
fn drop(&mut self) {
// Safety: We're the unique owner of this mutex and not going to use it afterwards.
unsafe { self.mutex.destroy() }
}
}
impl<T> Deref for ReentrantMutexGuard<'_, T> {
type Target = T;
-6
View File
@@ -126,9 +126,3 @@ pub unsafe fn write_unlock(&self) {
self.0.write_unlock()
}
}
impl Drop for MovableRwLock {
fn drop(&mut self) {
unsafe { self.0.destroy() };
}
}