Why is minimum Threading.Timer interval 15ms despite timeBeginPeriod(1)

落爺英雄遲暮 提交于 2019-12-01 08:47:14
Jim Mischel

The comment is wrong. My experience has been that the multimedia timer does not affect the .NET timers. That is, it doesn't change their minimum supported time period, which appears to be about 15 ms. It might improve their accuracy. That is, if you ask for 16 ms, you might actually get 16 ms and not "somewhere between 15 and 30 ms."

Why the .NET timers are limited to 15 ms is not clear to me.

There's some information about it in the accepted answer here.

If you're looking for a higher resolution timer for .NET, you probably shouldn't use the multimedia timers. Those have been deprecated in the Windows API. Use the Timer Queue Timers. See my articles:

Another option is to use the Waitable Timer. Full source for that is available at http://www.mischel.com/pubs/waitabletimer.zip

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!