Home Dashboard Directory Help
Search

SpinWait.SpinUntil incorrectly uses unstable system time. by Cory Nelson


Status: 

Closed
 as Fixed Help for as Fixed


1
0
Sign in
to vote
Type: Bug
ID: 621869
Opened: 11/14/2010 8:01:26 PM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

System.Threading.SpinWait.SpinUntil(Func<bool>, int) is supposed to stop spinning after it has tried for a number of milliseconds.

The current implementation, however, is based on the system time -- instead of trying for 'n' milliseconds, it tries until the system time reaches now+'n'. The difference is subtle, but means it can incorrectly try for too long or for too short if the system time changes.

The implementation should be changed to use either Environment.TickCount or a Stopwatch, which are not affected by the system time and will ensure it always tries for the correct amount of milliseconds.
Details
Sign in to post a comment.
Posted by Microsoft on 11/15/2010 at 1:13 AM
Thanks for your feedback.
We are routing this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 11/14/2010 at 8:22 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.