Skip to content

Commit

Permalink
Fixed concurrent test.
Browse files Browse the repository at this point in the history
  • Loading branch information
dragostis committed Sep 20, 2024
1 parent 1eebb6a commit da96ec5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ mod tests {
}
}

// #[test]
#[test]
fn concurrent_scopes() {
const NUM_THREADS: u8 = 128;
let threat_pool = ThreadPool::with_config(Config {
Expand All @@ -801,6 +801,14 @@ mod tests {
assert_eq!(a.load(Ordering::Relaxed), NUM_THREADS);
assert_eq!(b.load(Ordering::Relaxed), NUM_THREADS);

assert_eq!(threat_pool.context.lock.lock().unwrap().heartbeats.len(), 4);
for _ in 0..128 {
if threat_pool.context.lock.lock().unwrap().heartbeats.len() > 4 {
thread::yield_now();
} else {
return;
}
}

unreachable!()
}
}

0 comments on commit da96ec5

Please sign in to comment.