无论其他过程性能如何,都可以选择准确的定时。 [英] Options for Accurate timings regardless of other process performance.
问题描述
我们正试图使用timeSetEvent每500ms调用一次看门狗功能。
通常情况下看门狗没有任何问题。但是,当DVD插入驱动器时,我不会收到长达8秒的回调。使用WindowsQueue时,事情并不是那么糟糕,我得到了4秒钟。
我最后的尝试是将线程优先级设置为时间关键,然后休眠500ms ,但是8secs没有发生回调。
我还在运行XP,但是我不知道后来的操作系统会做什么改变这更好。
我以DVD插入为例。我希望代码在可能的情况下对其他条件具有鲁棒性。
任何建议都非常感谢。
We are trying to call a watchdog function every 500ms using timeSetEvent.
Normally the watchdog is called without any problems. However when a DVD is inserted into a drive I don't get a callback for up to 8 secs. Using WindowsQueue times things aren't quite so bad and I get a 4 second day.
My last attempt was to set thread priority to time critical and then sleep for 500ms, but again the callback didn't occur for 8secs.
I am still running XP, but I'm not aware of changes made in later operating systems which would make this better.
I am using the DVD insertion as an example. I'd like the code to be robust to other conditions if possible.
Any suggestions greatly appreciated.
推荐答案
我会在看门狗例程中测量进程的CPU时间,而不是假装准确的时序。
Instead of pretending accurate timing, I would measure, in the watchdog routine, the CPU time of the process.
这篇关于无论其他过程性能如何,都可以选择准确的定时。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!