看板 C_and_CPP 關於我們 聯絡資訊
開發平台(Platform): Windows7 編譯器(Ex: GCC, clang, VC++...) VC++ mmtimer的時間間隔設為2ms,其中故意放一個會超時的工作 > 2ms 以MFC Timer來看, 時間就是被打亂而已 但mmtimer會被影響,不只是本身的UI會卡住,連同Windows也會跟著卡住 請問有大大知道為什麼會這樣嗎? 謝謝 const int timePeriod = 2; const int timeRes = 1; void CALLBACK TimeEvent (UINT uTimerID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2) { for (int i=0; i<999999; i++) { } } -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.41.104.57 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1547187322.A.136.html
Schottky: 把時間間隔改回預設值就不會了。那個timeBeginPeriod() 01/11 16:07
Schottky: 是罪惡的根源,它把系統時間中斷從每秒18.2次加速到每 01/11 16:07
Schottky: 秒500次,整個 Windows 效能自然悲劇。 01/11 16:07
licheer: 因為某一次測試時,發生整個Windows都卡住 01/11 23:23
licheer: 原本用MFC Timer或是 C# Timer, 即便超時也只是拉長間隔 01/11 23:24
licheer: 沒料到mmtimer會這麼嚴重 01/11 23:24
Schottky: 你把 timeBeginPeriod() 那行刪掉就什麼事都沒有了 01/12 01:18