Skip to content

Commit

Permalink
Miri: Fix thread leaks in doctests in utils
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Jul 22, 2022
1 parent 6baa072 commit 2b65433
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 1 addition & 2 deletions ci/miri.sh
Expand Up @@ -9,8 +9,7 @@ echo

export RUSTFLAGS="${RUSTFLAGS:-} -Z randomize-layout"

# -Zmiri-ignore-leaks is needed because we use detached threads in tests/docs: https://github.com/rust-lang/miri/issues/1371
MIRIFLAGS="-Zmiri-symbolic-alignment-check -Zmiri-disable-isolation -Zmiri-ignore-leaks" \
MIRIFLAGS="-Zmiri-symbolic-alignment-check -Zmiri-disable-isolation" \
cargo miri test \
-p crossbeam-queue \
-p crossbeam-utils 2>&1 | ts -i '%.s '
Expand Down
2 changes: 2 additions & 0 deletions crossbeam-utils/src/backoff.rs
Expand Up @@ -201,6 +201,7 @@ impl Backoff {
/// assert_eq!(ready.load(SeqCst), false);
/// spin_wait(&ready);
/// assert_eq!(ready.load(SeqCst), true);
/// # std::thread::sleep(std::time::Duration::from_secs_f64(0.5)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
/// ```
///
/// [`AtomicBool`]: std::sync::atomic::AtomicBool
Expand Down Expand Up @@ -269,6 +270,7 @@ impl Backoff {
/// assert_eq!(ready.load(SeqCst), false);
/// blocking_wait(&ready);
/// assert_eq!(ready.load(SeqCst), true);
/// # std::thread::sleep(std::time::Duration::from_secs_f64(0.5)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
/// ```
///
/// [`AtomicBool`]: std::sync::atomic::AtomicBool
Expand Down
2 changes: 2 additions & 0 deletions crossbeam-utils/src/sync/parker.rs
Expand Up @@ -44,6 +44,7 @@ use std::time::{Duration, Instant};
///
/// // Wakes up when `u.unpark()` provides the token.
/// p.park();
/// # std::thread::sleep(std::time::Duration::from_secs_f64(0.5)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
/// ```
///
/// [`park`]: Parker::park
Expand Down Expand Up @@ -241,6 +242,7 @@ impl Unparker {
///
/// // Wakes up when `u.unpark()` provides the token.
/// p.park();
/// # std::thread::sleep(std::time::Duration::from_secs_f64(0.5)); // wait for background threads closed: https://github.com/rust-lang/miri/issues/1371
/// ```
///
/// [`park`]: Parker::park
Expand Down

0 comments on commit 2b65433

Please sign in to comment.