Tue Sep 16 21:02:59 CEST 2008 Paolo Molaro <lupus@ximian.com>
authorPaolo Molaro <lupus@oddwiz.org>
Tue, 16 Sep 2008 19:05:54 +0000 (19:05 -0000)
committerPaolo Molaro <lupus@oddwiz.org>
Tue, 16 Sep 2008 19:05:54 +0000 (19:05 -0000)
* Thread.cs: fixed SpinWait() implementation (bug #423582).

svn path=/trunk/mcs/; revision=113209

mcs/class/corlib/System.Threading/ChangeLog
mcs/class/corlib/System.Threading/Thread.cs

index 990dbbb4144aa28f14f2d60bd718805b633f4ae2..33bacda40c76ee69b776fa99d54a175a3425c4ba 100644 (file)
@@ -1,4 +1,8 @@
 
+Tue Sep 16 21:02:59 CEST 2008 Paolo Molaro <lupus@ximian.com>
+
+       * Thread.cs: fixed SpinWait() implementation (bug #423582).
+
 Tue Sep 9 15:19:48 CEST 2008 Paolo Molaro <lupus@ximian.com>
 
        * Timer.cs: use a separate queue for timers that are far in the future
index a1e44a48687c96ef299957aa37fc8404f37c9795..4ad5b328d3b71f78296c12475406f65191631a6f 100644 (file)
@@ -730,7 +730,7 @@ namespace System.Threading {
                }
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               private extern static void SpinWait_internal (int iterations);
+               private extern static void SpinWait_nop ();
 
 
 #if NET_2_0
@@ -738,7 +738,12 @@ namespace System.Threading {
 #endif
                public static void SpinWait (int iterations) 
                {
-                       SpinWait_internal (iterations);
+                       if (iterations < 0)
+                               return;
+                       while (iterations-- > 0)
+                       {
+                               SpinWait_nop ();
+                       }
                }
 
                public void Start() {