]> git.lizzy.rs Git - rust.git/blobdiff - src/libstd/sync/condvar.rs
std: Clean out deprecated APIs
[rust.git] / src / libstd / sync / condvar.rs
index 0ff3a6907026ed34cb5a699dbc986ccc46187f9f..64468be396f344f2f875fc079aacac2dfbbe5de5 100644 (file)
@@ -167,13 +167,12 @@ pub fn wait<'a, T>(&self, guard: MutexGuard<'a, T>)
     /// returns, regardless of whether the timeout elapsed or not.
     #[stable(feature = "rust1", since = "1.0.0")]
     #[rustc_deprecated(since = "1.6.0", reason = "replaced by `std::sync::Condvar::wait_timeout`")]
-    #[allow(deprecated)]
     pub fn wait_timeout_ms<'a, T>(&self, guard: MutexGuard<'a, T>, ms: u32)
                                   -> LockResult<(MutexGuard<'a, T>, bool)> {
-        unsafe {
-            let me: &'static Condvar = &*(self as *const _);
-            me.inner.wait_timeout_ms(guard, ms)
-        }
+        let res = self.wait_timeout(guard, Duration::from_millis(ms as u64));
+        poison::map_result(res, |(a, b)| {
+            (a, !b.timed_out())
+        })
     }
 
     /// Waits on this condition variable for a notification, timing out after a
@@ -200,30 +199,6 @@ pub fn wait_timeout<'a, T>(&self, guard: MutexGuard<'a, T>,
         }
     }
 
-    /// Waits on this condition variable for a notification, timing out after a
-    /// specified duration.
-    ///
-    /// The semantics of this function are equivalent to `wait_timeout` except
-    /// that the implementation will repeatedly wait while the duration has not
-    /// passed and the provided function returns `false`.
-    #[unstable(feature = "wait_timeout_with",
-               reason = "unsure if this API is broadly needed or what form it should take",
-               issue = "27748")]
-    #[rustc_deprecated(since = "1.8.0",
-                       reason = "wonky signature and questionable \
-                                 implementation didn't justify existence")]
-    pub fn wait_timeout_with<'a, T, F>(&self,
-                                       guard: MutexGuard<'a, T>,
-                                       dur: Duration,
-                                       f: F)
-                                       -> LockResult<(MutexGuard<'a, T>, WaitTimeoutResult)>
-            where F: FnMut(LockResult<&mut T>) -> bool {
-        unsafe {
-            let me: &'static Condvar = &*(self as *const _);
-            me.inner.wait_timeout_with(guard, dur, f)
-        }
-    }
-
     /// Wakes up one blocked thread on this condvar.
     ///
     /// If there is a blocked thread on this condition variable, then it will
@@ -286,26 +261,6 @@ pub fn wait<'a, T>(&'static self, guard: MutexGuard<'a, T>)
         }
     }
 
-    /// Waits on this condition variable for a notification, timing out after a
-    /// specified duration.
-    ///
-    /// See `Condvar::wait_timeout`.
-    #[unstable(feature = "static_condvar",
-               reason = "may be merged with Condvar in the future",
-               issue = "27717")]
-    #[rustc_deprecated(since = "1.6.0",
-                       reason = "replaced by `std::sync::StaticCondvar::wait_timeout`")]
-    pub fn wait_timeout_ms<'a, T>(&'static self, guard: MutexGuard<'a, T>, ms: u32)
-                                  -> LockResult<(MutexGuard<'a, T>, bool)> {
-        match self.wait_timeout(guard, Duration::from_millis(ms as u64)) {
-            Ok((guard, timed_out)) => Ok((guard, !timed_out.timed_out())),
-            Err(poison) => {
-                let (guard, timed_out) = poison.into_inner();
-                Err(PoisonError::new((guard, !timed_out.timed_out())))
-            }
-        }
-    }
-
     /// Waits on this condition variable for a notification, timing out after a
     /// specified duration.
     ///