From 6a7198830275c72ae406f969399bce350adf3d99 Mon Sep 17 00:00:00 2001 From: Paolo Molaro Date: Tue, 16 Sep 2008 19:05:54 +0000 Subject: [PATCH] Tue Sep 16 21:02:59 CEST 2008 Paolo Molaro * Thread.cs: fixed SpinWait() implementation (bug #423582). svn path=/trunk/mcs/; revision=113209 --- mcs/class/corlib/System.Threading/ChangeLog | 4 ++++ mcs/class/corlib/System.Threading/Thread.cs | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/mcs/class/corlib/System.Threading/ChangeLog b/mcs/class/corlib/System.Threading/ChangeLog index 990dbbb4144..33bacda40c7 100644 --- a/mcs/class/corlib/System.Threading/ChangeLog +++ b/mcs/class/corlib/System.Threading/ChangeLog @@ -1,4 +1,8 @@ +Tue Sep 16 21:02:59 CEST 2008 Paolo Molaro + + * Thread.cs: fixed SpinWait() implementation (bug #423582). + Tue Sep 9 15:19:48 CEST 2008 Paolo Molaro * Timer.cs: use a separate queue for timers that are far in the future diff --git a/mcs/class/corlib/System.Threading/Thread.cs b/mcs/class/corlib/System.Threading/Thread.cs index a1e44a48687..4ad5b328d3b 100644 --- a/mcs/class/corlib/System.Threading/Thread.cs +++ b/mcs/class/corlib/System.Threading/Thread.cs @@ -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() { -- 2.25.1