From fa3e66ea4225de823e7996e4d1a54d3f8cc68603 Mon Sep 17 00:00:00 2001 From: Steve MacLean Date: Wed, 23 May 2018 04:57:42 -0400 Subject: [PATCH] Fix race in test waitone1 (#18085) --- tests/src/baseservices/threading/mutex/misc/waitone1.cs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/tests/src/baseservices/threading/mutex/misc/waitone1.cs b/tests/src/baseservices/threading/mutex/misc/waitone1.cs index 40f144b..d5a0c5c 100644 --- a/tests/src/baseservices/threading/mutex/misc/waitone1.cs +++ b/tests/src/baseservices/threading/mutex/misc/waitone1.cs @@ -100,7 +100,7 @@ public class MutexWaitOne1 thread = new Thread(new ThreadStart(NeverReleaseMutex)); thread.Start(); - Thread.Sleep(100); + thread.Join(); m_Mutex.WaitOne(); TestLibrary.TestFramework.LogError("101", "AbandonedMutexException is not thrown if a thread exited without releasing a mutex"); @@ -115,13 +115,6 @@ public class MutexWaitOne1 TestLibrary.TestFramework.LogInformation(e.StackTrace); retVal = false; } - finally - { - if (null != thread) - { - thread.Join(); - } - } } return retVal; @@ -141,7 +134,7 @@ public class MutexWaitOne1 thread = new Thread(new ThreadStart(DisposeMutex)); thread.Start(); - Thread.Sleep(c_DEFAULT_SLEEP_TIME); + thread.Join(); m_Mutex.WaitOne(); TestLibrary.TestFramework.LogError("103", "ObjectDisposedException is not thrown if current instance has already been disposed"); @@ -158,11 +151,6 @@ public class MutexWaitOne1 } finally { - if (null != thread) - { - thread.Join(); - } - if (null != m_Mutex) { ((IDisposable)m_Mutex).Dispose(); -- 2.7.4