Module: wine Branch: refs/heads/master Commit: 11c1bcf6def5f7fe8e5588c71a28fb237fe9af9c URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=11c1bcf6def5f7fe8e5588c7...
Author: Robert Shearman rob@codeweavers.com Date: Thu Jul 13 13:07:13 2006 +0100
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.
---
dlls/ole32/compobj.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index a25d9ec..4efa235 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -2875,7 +2875,12 @@ HRESULT WINAPI CoWaitForMultipleHandles( if (res == WAIT_OBJECT_0 + cHandles) /* messages available */ { 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 */ TRACE("received message whilst waiting for RPC: 0x%04x\n", msg.message); @@ -2887,7 +2892,6 @@ HRESULT WINAPI CoWaitForMultipleHandles( PostQuitMessage(msg.wParam); /* no longer need to process messages */ message_loop = FALSE; - break; } } continue;