@@ -28,8 +28,9 @@ fn wait_wake() {
2828 ) ;
2929 }
3030 } ) ;
31- thread:: yield_now ( ) ;
32- let mut timeout = libc:: timespec { tv_sec : 0 , tv_nsec : 400_000_000 } ;
31+
32+ // 10ms should be enough.
33+ let mut timeout = libc:: timespec { tv_sec : 0 , tv_nsec : 10_000_000 } ;
3334 let timeout_size_arg =
3435 ptr:: without_provenance_mut :: < libc:: c_void > ( mem:: size_of :: < libc:: timespec > ( ) ) ;
3536 unsafe {
@@ -51,13 +52,13 @@ fn wait_wake() {
5152 }
5253
5354 fn wake_two_of_three ( ) {
54- // We create 2 threads that wait on a futex with a 500ms timeout.
55- // The main thread wakes up 1 thread waiting on this futex and after this
56- // checks that only 1 thread woke up and the other timed out.
55+ // We create 2 threads that wait on a futex with a 100ms timeout.
56+ // The main thread wakes up 2 threads waiting on this futex and after this
57+ // checks that only those threads woke up and the other one timed out.
5758 static mut FUTEX : u32 = 0 ;
5859
5960 fn waiter ( ) -> bool {
60- let mut timeout = libc:: timespec { tv_sec : 0 , tv_nsec : 500_000_000 } ;
61+ let mut timeout = libc:: timespec { tv_sec : 0 , tv_nsec : 100_000_000 } ;
6162 let timeout_size_arg =
6263 ptr:: without_provenance_mut :: < libc:: c_void > ( mem:: size_of :: < libc:: timespec > ( ) ) ;
6364 unsafe {
@@ -77,7 +78,9 @@ fn wait_wake() {
7778 let t2 = thread:: spawn ( waiter) ;
7879 let t3 = thread:: spawn ( waiter) ;
7980
81+ // Run all the waiters, so they can go to sleep.
8082 thread:: yield_now ( ) ;
83+
8184 // Wake up 2 thread and make sure 1 is still waiting.
8285 unsafe {
8386 assert_eq ! (
0 commit comments