PATCH: PeekMessage - reducing load

Marcus Meissner marcus at jet.franken.de
Fri May 18 14:57:55 CDT 2001


Hi,

winword.exe apparently uses a while (PeekMessage()) loop. 

Both wineserver and 1 wine thread take up 90% CPU even if idle.

This adds a timeout of 10 milliseconds so we are still interactive, 
but do not take up as much CPU. (We basically wait 1 timeslice if 100HZ
scheduling).

Ciao, Marcus

Changelog:
	if application is polling with PeekMessage() wait
	10 milliseconds if no events are there so we don't spin
	at 100% CPU.

Index: message.c
===================================================================
RCS file: /home/wine/wine/windows/message.c,v
retrieving revision 1.104
diff -u -r1.104 message.c
--- message.c	2001/05/16 19:52:31	1.104
+++ message.c	2001/05/18 20:56:17
@@ -1255,7 +1255,7 @@
 #endif
             /* check for graphics events */
             if (USER_Driver.pMsgWaitForMultipleObjects)
-                USER_Driver.pMsgWaitForMultipleObjects( 0, NULL, FALSE, 0 );
+                USER_Driver.pMsgWaitForMultipleObjects( 0, NULL, FALSE, 10 );
 
             QUEUE_Unlock( msgQueue );
             WIN_RestoreWndsLock(iWndsLocks);




More information about the wine-patches mailing list