Merge pull request #4154 from RalfJung/linux-futex

make linux-futex test less flaky
This commit is contained in:
Ralf Jung 2025-01-26 19:58:43 +00:00 committed by GitHub
commit 05a2dcdbd0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -235,7 +235,7 @@ fn concurrent_wait_wake() {
static mut DATA: i32 = 0;
static WOKEN: AtomicI32 = AtomicI32::new(0);
let rounds = 50;
let rounds = 64;
for _ in 0..rounds {
unsafe { DATA = 0 }; // Reset
// Suppose the main thread is holding a lock implemented using futex...
@ -267,8 +267,7 @@ fn concurrent_wait_wake() {
}
});
// Increase the chance that the other thread actually goes to sleep.
// (5 yields in a loop seem to make that happen around 40% of the time.)
for _ in 0..5 {
for _ in 0..6 {
thread::yield_now();
}