Skip to content

Commit

Permalink
linux-futex test: ensure we join all threads
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jun 7, 2022
1 parent aa68111 commit 2b35dd5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/pass/concurrency/linux-futex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ fn wait_wake() {

static FUTEX: i32 = 0;

thread::spawn(move || {
let t = thread::spawn(move || {
thread::sleep(Duration::from_millis(200));
unsafe {
assert_eq!(libc::syscall(
Expand All @@ -155,14 +155,15 @@ fn wait_wake() {
}

assert!((200..1000).contains(&start.elapsed().as_millis()));
t.join().unwrap();
}

fn wait_wake_bitset() {
let start = Instant::now();

static FUTEX: i32 = 0;

thread::spawn(move || {
let t = thread::spawn(move || {
thread::sleep(Duration::from_millis(200));
unsafe {
assert_eq!(libc::syscall(
Expand Down Expand Up @@ -202,6 +203,7 @@ fn wait_wake_bitset() {
}

assert!((400..1000).contains(&start.elapsed().as_millis()));
t.join().unwrap();
}

fn main() {
Expand Down

0 comments on commit 2b35dd5

Please sign in to comment.