Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanieu committed Jan 28, 2022
1 parent 4d64bc6 commit 78a16dd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
15 changes: 1 addition & 14 deletions src/condvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/elision.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 78a16dd

Please sign in to comment.