.NET Thread.Sleep() is randomly imprecise

前端 未结 7 1908
故里飘歌
故里飘歌 2021-01-20 01:34

In my .NET application I have to replay a series of sensor events. So I created a thread that fires these events (usually about every 1 - 4 millisecond). I implemented a loo

7条回答
  •  花落未央
    2021-01-20 02:11

    Windows is not a real time operating system.

    The scheduler may wait longer than the requested sleep duration to execute a thread, especially if another thread is still busy.

    Try use the Multimedia Timer if you want more reliability. There is a .NET wrapper here.

提交回复
热议问题