Reduce race risk in MutexWaitOne2::PosTest4() (#18195)
authorSteve MacLean <sdmaclea.qdt@qualcommdatacenter.com>
Sat, 2 Jun 2018 02:04:39 +0000 (22:04 -0400)
committerKoundinya Veluri <kouvel@users.noreply.github.com>
Sat, 2 Jun 2018 02:04:39 +0000 (19:04 -0700)
tests/src/baseservices/threading/mutex/misc/waitone2.cs

index 6c1821c..cfb4992 100644 (file)
@@ -206,8 +206,8 @@ public class MutexWaitOne2
 
             thread = new Thread(new ThreadStart(CallContextBoundObjectMethod));
             thread.Start();
-            Thread.Sleep(c_DEFAULT_SLEEP_TIME / 5); // To avoid race
-            if (false != m_Mutex.WaitOne(c_DEFAULT_SLEEP_TIME))
+            Thread.Sleep(c_DEFAULT_SLEEP_TIME); // To avoid race
+            if (false != m_Mutex.WaitOne(c_DEFAULT_SLEEP_TIME / 5))
             {
                 m_Mutex.ReleaseMutex();
                 TestLibrary.TestFramework.LogError("006", "WaitOne returns true when wait some finite time will quit for timeout when another thread is in nondefault managed context");