Changeset 8960 for trunk/src


Ignore:
Timestamp:
Aug 5, 2002, 11:45:49 AM (23 years ago)
Author:
sandervl
Message:

MsgWaitForMultipleObjects changes; check objects before message queue status

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/windowmsg.cpp

    r8956 r8960  
    1 /* $Id: windowmsg.cpp,v 1.37 2002-08-01 16:10:51 sandervl Exp $ */
     1/* $Id: windowmsg.cpp,v 1.38 2002-08-05 09:45:49 sandervl Exp $ */
    22/*
    33 * Win32 window message APIs for OS/2
     
    884884    }
    885885    if(dwMilliseconds == 0) { //case 2
    886         //TODO: what has a higher priority; message presence or signalled object?
     886        if(nCount) {
     887            ret = WaitForMultipleObjects(nCount, pHandles, fWaitAll, dwMilliseconds);
     888            if(ret < WAIT_OBJECT_0 + nCount) {
     889                return ret;
     890            }
     891        }
    887892        if(GetQueueStatus(dwWakeMask) == 0) {
    888             if(nCount) {
    889                 return WaitForMultipleObjects(nCount, pHandles, fWaitAll, dwMilliseconds);
    890             }
    891893            return WAIT_TIMEOUT;
    892894        }
     
    934936       return WAIT_ABANDONED;
    935937    }
     938    //check if any object is already signalled
     939    ret = WaitForMultipleObjects(nCount, pHandles, fWaitAll, 0);
     940    if(ret < WAIT_OBJECT_0 + nCount) {
     941        return ret;
     942    }
    936943    //if the msg queue already contains the messages defined by dwWakeMask,
    937944    //then return immediately
     
    947954        memcpy(pHandlesTmp, pHandles, nCount*sizeof(HANDLE));
    948955        pHandlesTmp[nCount] = teb->o.odin.hPostMsgEvent;
     956
     957        //mark this thread as waiting for window messages
    949958        teb->o.odin.dwWakeMask = dwWakeMask;
    950959
    951960        ResetEvent(teb->o.odin.hPostMsgEvent);
    952961        ret = HMMsgWaitForMultipleObjects(nCount+1,pHandlesTmp,fWaitAll,dwMilliseconds,dwWakeMask);
     962
     963        //unmark thread
     964        teb->o.odin.dwWakeMask = 0;
     965
    953966        //nCount + 2 -> message event -> return nCount + 1
    954         teb->o.odin.dwWakeMask = 0;
    955967        return (ret == nCount + 2) ? (nCount + 1) : ret;
    956968    }
Note: See TracChangeset for help on using the changeset viewer.