Relax a mutex test condition (dotnet/corefx#39786)
authorKoundinya Veluri <kouvel@users.noreply.github.com>
Thu, 25 Jul 2019 22:21:00 +0000 (15:21 -0700)
committerStephen Toub <stoub@microsoft.com>
Thu, 25 Jul 2019 22:21:00 +0000 (18:21 -0400)
commit86953da4c4b0b60c58bdcf623c3ec77cb6ed1201
tree53f4080420829c5dcf15bf731f2bfe1824548487
parent3cfddb1f5406e06e22e075526c343f7706b33ea7
Relax a mutex test condition (dotnet/corefx#39786)

Fixes https://github.com/dotnet/corefx/issues/39694
- When doing a `WaitAny()` with mutexes that are expected to be abandoned and an event that is signaled, it has been seen in the CI on Windows that sometimes the `WaitAny()` may succeed due to event rather than identifying an abandoned mutex. The CLR doesn't do anything special and just delegates to the OS, the only way that could happen is if there could be a delay between the thread exiting and the mutex being released and abandoned. I haven't been able to repro that behavior or the test failure on my machine, it may not be easy to repro, even in the CI it fails only occasionally.
- It's not a bug as long as the mutex eventually gets released and abandoned. Relaxed the condition for `WaitAny()` with an event following a mutex to account for a delay.

Commit migrated from https://github.com/dotnet/corefx/commit/97d5957fc71853961082e22873d926269b291b92
src/libraries/System.Threading/tests/MutexTests.cs