summaryrefslogtreecommitdiff
path: root/tests/src
diff options
context:
space:
mode:
authorCarol Eidt <carol.eidt@microsoft.com>2019-06-21 14:26:11 -0700
committerGitHub <noreply@github.com>2019-06-21 14:26:11 -0700
commitec54de73c309d64fcf4683c5e23c9065cd16fd08 (patch)
tree56ac049665a6fdef407d7c45fd0e2087cda23c39 /tests/src
parent457c13d6b561ec7ff2a48d3d2599c5dcaed7b728 (diff)
downloadcoreclr-ec54de73c309d64fcf4683c5e23c9065cd16fd08.tar.gz
coreclr-ec54de73c309d64fcf4683c5e23c9065cd16fd08.tar.bz2
coreclr-ec54de73c309d64fcf4683c5e23c9065cd16fd08.zip
Fix test to use mutual waits (#25317)
Fix #25245
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/JIT/jit64/opt/rngchk/ArrayWithThread.cs17
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/src/JIT/jit64/opt/rngchk/ArrayWithThread.cs b/tests/src/JIT/jit64/opt/rngchk/ArrayWithThread.cs
index c646a69bef..5f8347919a 100644
--- a/tests/src/JIT/jit64/opt/rngchk/ArrayWithThread.cs
+++ b/tests/src/JIT/jit64/opt/rngchk/ArrayWithThread.cs
@@ -12,7 +12,8 @@ namespace ArrayWithThread
internal class Class1
{
public static int val = 0;
- public static AutoResetEvent myResetEvent = new AutoResetEvent(false);
+ public static AutoResetEvent myResetEvent1 = new AutoResetEvent(false);
+ public static ManualResetEvent myResetEvent2 = new ManualResetEvent(false);
private static int Main()
{
int retVal = 100;
@@ -38,7 +39,8 @@ namespace ArrayWithThread
private static bool DoTest(RngTest Test)
{
bool bResult = false;
- myResetEvent.Reset();
+ myResetEvent1.Reset();
+ myResetEvent2.Reset();
try
{
Thread t = new Thread(new ThreadStart(Class1.ThreadFunc));
@@ -58,8 +60,9 @@ namespace ArrayWithThread
}
private static void ThreadFunc()
{
- myResetEvent.WaitOne();
+ myResetEvent1.WaitOne();
Class1.val = 101;
+ myResetEvent2.Set();
return;
}
}
@@ -71,8 +74,8 @@ namespace ArrayWithThread
int[] numbers = new int[100];
for (; index < numbers.Length; index++)
{
- Class1.myResetEvent.Set();
- Thread.Sleep(1);
+ Class1.myResetEvent1.Set();
+ Class1.myResetEvent2.WaitOne();
numbers[index] = index * index;
}
}
@@ -85,8 +88,8 @@ namespace ArrayWithThread
upper = numbers.Length;
for (; index < upper; index++)
{
- Class1.myResetEvent.Set();
- Thread.Sleep(1);
+ Class1.myResetEvent1.Set();
+ Class1.myResetEvent2.WaitOne();
numbers[index] = index * index;
}
}