Problems with using Thread.Sleep for short times

前端 未结 5 885
执笔经年
执笔经年 2020-12-11 06:42

I have an app with 2 threads (now), but it seems that function Thread.Sleep() doesn\'t work very good. It sleeps threads but it takes much more time (for example- I want to

5条回答
  •  清歌不尽
    2020-12-11 07:00

    Sleep in Microsoft C# guarantees a minimum amount of time. It sleeping less than 5 milliseconds is definitely a problem. Also Stopwatch may not be very precise measurement, try the high precision media timers.

提交回复
热议问题