mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
Use Drop instead of destroy() for locks.
This commit is contained in:
@@ -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() };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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() };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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() };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user