Minor fixes

This commit is contained in:
Amanieu d'Antras
2022-01-28 19:24:04 +00:00
parent 8ce068b4a2
commit 138342b376
2 changed files with 2 additions and 15 deletions
+1 -14
View File
@@ -380,12 +380,6 @@ impl Condvar {
///
/// Like `wait`, the lock specified will be re-acquired when this function
/// returns, regardless of whether the timeout elapsed or not.
///
/// # Panics
///
/// Panics if the given `timeout` is so large that it can't be added to the current time.
/// This panic is not possible if the crate is built with the `nightly` feature, then a too
/// large `timeout` becomes equivalent to just calling `wait`.
#[inline]
pub fn wait_for<T: ?Sized>(
&self,
@@ -556,14 +550,7 @@ mod tests {
let _g = m2.lock();
c2.notify_one();
});
// Non-nightly panics on too large timeouts. Nightly treats it as indefinite wait.
let very_long_timeout = if cfg!(feature = "nightly") {
Duration::from_secs(u64::max_value())
} else {
Duration::from_millis(u32::max_value() as u64)
};
let timeout_res = c.wait_for(&mut g, very_long_timeout);
let timeout_res = c.wait_for(&mut g, Duration::from_secs(u64::max_value()));
assert!(!timeout_res.timed_out());
drop(g);
+1 -1
View File
@@ -5,7 +5,7 @@
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to those terms.
#[cfg(all(feature = "nightly", any(target_arch = "x86", target_arch = "x86_64")))]
#[cfg(all(feature = "hardware-lock-elision", any(target_arch = "x86", target_arch = "x86_64")))]
use std::arch::asm;
use std::sync::atomic::AtomicUsize;