ole32: Don't loop while peeking messages in CoWaitForMultipleHandles.

It increases the latency on completing the COM call and could result in 
the COM call never completing in some circumstances.
This commit is contained in:
Robert Shearman 2006-07-13 13:07:13 +01:00 committed by Alexandre Julliard
parent f9c9a2bf3d
commit 11c1bcf6de
1 changed files with 6 additions and 2 deletions

View File

@ -2875,7 +2875,12 @@ HRESULT WINAPI CoWaitForMultipleHandles(DWORD dwFlags, DWORD dwTimeout,
if (res == WAIT_OBJECT_0 + cHandles) /* messages available */ if (res == WAIT_OBJECT_0 + cHandles) /* messages available */
{ {
MSG msg; MSG msg;
while (COM_PeekMessage(apt, &msg))
/* note: using "if" here instead of "while" might seem less
* efficient, but only if we are optimising for quick delivery
* of pending messages, rather than quick completion of the
* COM call */
if (COM_PeekMessage(apt, &msg))
{ {
/* FIXME: filter the messages here */ /* FIXME: filter the messages here */
TRACE("received message whilst waiting for RPC: 0x%04x\n", msg.message); TRACE("received message whilst waiting for RPC: 0x%04x\n", msg.message);
@ -2887,7 +2892,6 @@ HRESULT WINAPI CoWaitForMultipleHandles(DWORD dwFlags, DWORD dwTimeout,
PostQuitMessage(msg.wParam); PostQuitMessage(msg.wParam);
/* no longer need to process messages */ /* no longer need to process messages */
message_loop = FALSE; message_loop = FALSE;
break;
} }
} }
continue; continue;