[PATCH] USER16_AlertableWait slows PeekMessage down

Michael Karcher karcher at physik.fu-berlin.de
Thu May 17 17:01:05 CDT 2007


Currently, if a serial port is in use, USER16_AlertableWait is set to
make PeekMessage and GetMessage also return on I/O completion calls that
are queued. For PeekMessage, a timeout of 1 millisecond is used. This kills
performance in the remote configuration application for our SOHO PBX.
This program has a reading loop approximating this:

while(1)
{
  READCOMM(1 byte), add to buffer
  GETCOMMERROR(), handling errors
  if(PEEKMESSAGE) HANDLE_MESSAGE()
  time=GETTIME_VIA_DOS();
  if(time > timeout) ERROR();
}

This incurs a sleep per received character. The attached patch reduces the
timeout to zero, to still check for APC, but inhibts waiting.
---
 dlls/user32/msg16.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dlls/user32/msg16.c b/dlls/user32/msg16.c
index 3193a60..421f338 100644
--- a/dlls/user32/msg16.c
+++ b/dlls/user32/msg16.c
@@ -164,7 +164,7 @@ BOOL16 WINAPI PeekMessage32_16( MSG32_16 *msg16, HWND16 hwnd16,
     HWND hwnd = WIN_Handle32( hwnd16 );
 
     if(USER16_AlertableWait)
-        MsgWaitForMultipleObjectsEx( 0, NULL, 1, 0, MWMO_ALERTABLE );
+        MsgWaitForMultipleObjectsEx( 0, NULL, 0, 0, MWMO_ALERTABLE );
     if (!PeekMessageA( &msg, hwnd, first, last, flags )) return FALSE;
 
     msg16->msg.time    = msg.time;
-- 
1.4.4.4




More information about the wine-patches mailing list