[interp] Remove unreachable code (#12411)
[mono-project.git] / mono / tests / sleep.cs
blobf85d540358d4c3a6a215d05e9c6f69d91ac7058b
1 using System;
2 using System.Threading;
3 using System.Diagnostics;
5 public class Tests
7 static bool finished;
9 public static int Main (String[] args) {
10 return TestDriver.RunTests (typeof (Tests), args);
13 public static int test_0_time_drift () {
14 // Test the Thread.Sleep () is able to deal with time drifting due to interrupts
15 Thread t = new Thread (delegate () {
16 while (!finished) {
17 GC.Collect ();
18 Thread.Yield ();
20 });
21 t.Start ();
23 var sw = Stopwatch.StartNew ();
24 Thread.Sleep (1000);
25 finished = true;
26 sw.Stop ();
27 if (sw.ElapsedMilliseconds > 2000) {
28 Console.WriteLine (sw.ElapsedMilliseconds);
29 return 1;
30 } else {
31 return 0;