开发者

length of ticks in a tickless operating system

My understanding of winmm.dll is it can change the length of the "ticks"开发者_运维问答.

In a tickless OS like Windows 7, what use/effect does this have if any?


Calling timeBeginPeriod doesn't let you change the length of "ticks", but rather sets the minimum resolution that you expect from the multimedia timer functions. If you call timeBeginPeriod(1), then you can expect 1-millisecond resolution (at best) from your timers you set by calling timeSetEvent.

Unless you're using the multimedia timers (which you probably shouldn't be doing, considering they've been deprecated in favor of the thread pool timers), there's no reason ever to call timeBeginPeriod or even to worry about it. There are, however, compelling reasons not to call timeBeginPeriod or any other function that sets the minimum timer resolution. See http://www.microsoft.com/whdc/system/pnppwr/powermgmt/Timer-Resolution.mspxas.

Windows keeps track of time in intervals of 100 nanosecond "ticks", regardless of what you set with timeBeginPeriod. timeBeginPeriod is just a way to get a more granular periodic event if you really need it. It has no effect on how Windows keeps time.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜