mirror of
https://github.com/openharmony/third_party_rust_parking_lot.git
synced 2026-07-01 21:03:59 -04:00
Minor fixes
This commit is contained in:
+1
-14
@@ -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
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user