summaryrefslogtreecommitdiffstats
path: root/vendor/crossbeam-channel/tests/mpsc.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:03:36 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:03:36 +0000
commit17d40c6057c88f4c432b0d7bac88e1b84cb7e67f (patch)
tree3f66c4a5918660bb8a758ab6cda5ff8ee4f6cdcd /vendor/crossbeam-channel/tests/mpsc.rs
parentAdding upstream version 1.64.0+dfsg1. (diff)
downloadrustc-17d40c6057c88f4c432b0d7bac88e1b84cb7e67f.tar.xz
rustc-17d40c6057c88f4c432b0d7bac88e1b84cb7e67f.zip
Adding upstream version 1.65.0+dfsg1.upstream/1.65.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/crossbeam-channel/tests/mpsc.rs')
-rw-r--r--vendor/crossbeam-channel/tests/mpsc.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/vendor/crossbeam-channel/tests/mpsc.rs b/vendor/crossbeam-channel/tests/mpsc.rs
index 3db4812c6..d7cc8e25f 100644
--- a/vendor/crossbeam-channel/tests/mpsc.rs
+++ b/vendor/crossbeam-channel/tests/mpsc.rs
@@ -339,25 +339,22 @@ mod channel_tests {
#[test]
fn stress_shared() {
- #[cfg(miri)]
- const AMT: u32 = 100;
- #[cfg(not(miri))]
- const AMT: u32 = 10000;
- const NTHREADS: u32 = 8;
+ let amt: u32 = if cfg!(miri) { 100 } else { 10_000 };
+ let nthreads: u32 = if cfg!(miri) { 4 } else { 8 };
let (tx, rx) = channel::<i32>();
let t = thread::spawn(move || {
- for _ in 0..AMT * NTHREADS {
+ for _ in 0..amt * nthreads {
assert_eq!(rx.recv().unwrap(), 1);
}
assert!(rx.try_recv().is_err());
});
- let mut ts = Vec::with_capacity(NTHREADS as usize);
- for _ in 0..NTHREADS {
+ let mut ts = Vec::with_capacity(nthreads as usize);
+ for _ in 0..nthreads {
let tx = tx.clone();
let t = thread::spawn(move || {
- for _ in 0..AMT {
+ for _ in 0..amt {
tx.send(1).unwrap();
}
});