changed waitForEvent() to handle a peculiar feature of

MsgWaitForMultipleObjects():  it will not return immediately
if an event already in the queue when it's called was already
in the queue during the last call to GetMessage()/PeekMessage().
also now discarding screen saver events if there are any other
screen saver events in the queue already.  this prevents these
events from piling up in the queue, which they'd do because we
sleep for 250ms when handling each one.
This commit is contained in:
crs
2002-07-18 16:58:08 +00:00
parent e94f308e21
commit 0759cbc104
2 changed files with 33 additions and 11 deletions

View File

@@ -628,6 +628,14 @@ CThreadRep::wait(CThreadRep* target, double timeout)
bool
CThreadRep::waitForEvent(double timeout)
{
// check if messages are available first. if we don't do this then
// MsgWaitForMultipleObjects() will block even if the queue isn't
// empty if the messages in the queue were there before the last
// call to GetMessage()/PeekMessage().
if (HIWORD(GetQueueStatus(QS_ALLINPUT)) != 0) {
return true;
}
// is cancellation enabled?
const DWORD n = (isCancellable() ? 1 : 0);