projects
/
mono.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bump version to 5.9.0 (#5692)
[mono.git]
/
mono
/
tests
/
sgen-new-threads-collect.cs
diff --git
a/mono/tests/sgen-new-threads-collect.cs
b/mono/tests/sgen-new-threads-collect.cs
index c5d5e4aa26adab5eb928aa7a58f1bdfb5a015c89..d76b1d552906e131325ad6c08f0defd76c7a64ba 100644
(file)
--- a/
mono/tests/sgen-new-threads-collect.cs
+++ b/
mono/tests/sgen-new-threads-collect.cs
@@
-5,20
+5,16
@@
using System.Threading;
class Driver
{
class Driver
{
- static DateTime targetTime;
- static bool finished() {
- DateTime now = DateTime.UtcNow;
- return now > targetTime;
- }
+ static TestTimeout timeout;
public static void Main ()
{
int gcCount = 0;
int joinCount = 0;
public static void Main ()
{
int gcCount = 0;
int joinCount = 0;
-
targetTime = DateTime.UtcNow.AddSeconds(30
);
+
TestTimeout timeout = TestTimeout.Start(TimeSpan.FromSeconds(TestTimeout.IsStressTest ? 60 : 5)
);
Thread gcThread = new Thread (() => {
Thread gcThread = new Thread (() => {
- while (
!finished()
) {
+ while (
timeout.HaveTimeLeft
) {
GC.Collect ();
gcCount++;
Thread.Sleep (1);
GC.Collect ();
gcCount++;
Thread.Sleep (1);
@@
-27,8
+23,8
@@
class Driver
gcThread.Start ();
gcThread.Start ();
- // Create threads then join them for
30 seconds
nonstop while GCs occur once per ms
- while (
!finished()
) {
+ // Create threads then join them for
1 seconds (120 for stress tests)
nonstop while GCs occur once per ms
+ while (
timeout.HaveTimeLeft
) {
BlockingCollection<Thread> threads = new BlockingCollection<Thread> (new ConcurrentQueue<Thread> (), 128);
Thread joinThread = new Thread (() => {
BlockingCollection<Thread> threads = new BlockingCollection<Thread> (new ConcurrentQueue<Thread> (), 128);
Thread joinThread = new Thread (() => {
@@
-57,7
+53,7
@@
class Driver
joinThread.Join ();
joinCount += makeThreads;
joinThread.Join ();
joinCount += makeThreads;
- Console.WriteLine("Performed {0} GCs, created {1} threads. Finished? {2}", gcCount, joinCount,
finished()
);
+ Console.WriteLine("Performed {0} GCs, created {1} threads. Finished? {2}", gcCount, joinCount,
!timeout.HaveTimeLeft
);
}
gcThread.Join ();
}
}
gcThread.Join ();
}