From 11c1bcf6def5f7fe8e5588c71a28fb237fe9af9c Mon Sep 17 00:00:00 2001 From: Robert Shearman Date: Thu, 13 Jul 2006 13:07:13 +0100 Subject: [PATCH] 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 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index a25d9ecc9b..4efa2357d0 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -2875,7 +2875,12 @@ HRESULT WINAPI CoWaitForMultipleHandles(DWORD dwFlags, DWORD dwTimeout, 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(DWORD dwFlags, DWORD dwTimeout, PostQuitMessage(msg.wParam); /* no longer need to process messages */ message_loop = FALSE; - break; } } continue; -- 2.32.0.93.g670b81a890