[Fix] Adjust SpinWait values to stall the thread earlier. Fix #624849.
authorJérémie Laval <jeremie.laval@gmail.com>
Sat, 31 Jul 2010 10:45:24 +0000 (12:45 +0200)
committerJérémie Laval <jeremie.laval@gmail.com>
Sat, 31 Jul 2010 10:48:19 +0000 (12:48 +0200)
mcs/class/corlib/System.Threading/SpinWait.cs

index c93380ef46167780dfbc025e0f77c0aa88bfa0b9..73d89609e08d5107b0a693a242571fcbb1ea6596 100644 (file)
@@ -30,15 +30,15 @@ namespace System.Threading
        public struct SpinWait
        {
                // The number of step until SpinOnce yield on multicore machine
-               const           int  step = 5;
-               const           int  maxSpin = 10000;
+               const           int  step = 10;
+               const           int  maxSpin = 1000;
                static readonly bool isSingleCpu = (Environment.ProcessorCount == 1);
 
                int ntime;
 
                public void SpinOnce ()
                {
-                       if (ntime > 2 * maxSpin) {
+                       if (ntime > maxSpin) {
                                Thread.Sleep (1);
                        } else if (isSingleCpu) {
                                // On a single-CPU system, spinning does no good