Main Site Documentation

Thread.Sleep...what is the minimum?


#1

When I say Thread.Sleep(1) on the FezMini, does it really sleep for 1 millisecond? Or is there a minimum that it really sleeps?

I remember this was an issue on Windows 95/98. Thread.Sleep (the MFC equivalent) would sleep at least 55 milliseconds.


#2

It is 1ms in most cases


#3

circa .Net 2.0 I remember clock resolution was ±50ms for things like Timer - not sure about Sleep(). In .Net 4.0 and MF time they might have made a change and they also added high rez timer. However, even if perfect time, if you have other threads (i.e. Timer callbacks, etc) your thread run may not fall on exact time and most likely not sub-ms time. Even if doing a spin-wait, other things like gc or runtime code could get in way. Would be a good potential post from Collin.