Make the in-flight claim test wait for the waiter to park
a_second_claim_waits_for_the_first_to_be_released failed on CI: the second claim came back Some. The waiter thread signalled the main thread before calling claim, so the main thread could drop the first guard before the waiter reached the lock. The path was free by then, and the waiter claimed it outright. The registry now keeps a test-only count of threads parked in claim, bumped under the lock just before the condvar wait. The test spins until that count is one before releasing. The release needs the same lock, so it can only reach a waiter that is already waiting. Passed 500 runs in a row.
This commit is contained in:
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user