Revert stalling changes introduced in SpinWait. Add a guard for ntime overflow.
[mono.git] / mcs / class / corlib / System.Threading / Timer.cs
index f484cfd7d7d7ebaa02afb4802e05b802a65cf641..d0f9a6562354699d9bea9fdf3ab996f06612a008 100644 (file)
@@ -33,9 +33,7 @@ using System.Collections;
 
 namespace System.Threading
 {
-#if NET_2_0
        [ComVisible (true)]
-#endif
        public sealed class Timer : MarshalByRefObject, IDisposable
        {
                static Scheduler scheduler = Scheduler.Instance;
@@ -71,12 +69,10 @@ namespace System.Threading
                        Init (callback, state, d, p);
                }
 
-#if NET_2_0
                public Timer (TimerCallback callback)
                {
                        Init (callback, this, Timeout.Infinite, Timeout.Infinite);
                }
-#endif
 
                void Init (TimerCallback callback, object state, long dueTime, long period)
                {
@@ -181,7 +177,9 @@ namespace System.Threading
                                if (ty == null)
                                        return 1;
                                long result = tx.next_run - ty.next_run;
-                               return result > 0 ? 1 : result < 0 ? -1 : 0;
+                               if (result == 0)
+                                       return x == y ? 0 : -1;
+                               return result > 0 ? 1 : -1;
                        }
                }