[Win32Lib] w32HIdle eating up CPU time
- Posted by Martin Stachon <martin.stachon at worldonline.cz> Feb 27, 2003
- 430 views
Hello Derek, perhaps you have fixed this in 0.58.2... With 0.58, even a simple single window win32lib application, when deactived (swiched to another app) eats up all avaible CPU time, and usually locks up. (I have WinXP) Same application coded using API directly or with older win32lib, take up 0-1% CPU time. I think the reason is w32HIdle. If I comment-out the following lines in eventLoop(), CPU usage is 0-1% again : -- while w32Func(xGetQueueStatus, {QS_ALLEVENTS}) = 0 do -- lTock += 1 -- if sequence(invokeHandler(Screen, w32HIdle, {lTock, msg})) then -- lTock = -1 -- exit -- end if -- end while -- if lTock >= 0 then getRC = w32Func( xGetMessage, { msg, hWnd, 0, 0 } ) if getRC = 0 or getRC = -1 then exit end if -- if lTock > 0 then -- VOID = invokeHandler(Screen, w32HIdle, {-1, msg}) -- end if -- end if I guess something is wrong with GetQueueStatus() usage. WINAPI says : "For this reason, the return value from GetQueueStatus should be considered only a hint as to whether GetMessage or PeekMessage should be called." If there is no way to get around this, I can live without w32HIdle... Regards, Martin