Logo Search packages:      
Sourcecode: virtualbox-ose version File versions  Download package

BOOL com::EventQueue::waitForEvent ( Event **  event  ) 

Waits for a single event. This method must be called on the same thread where this event queue is created.

After this method returns TRUE and non-NULL event, the caller should call handleEvent() in order to process the returned event (otherwise the event is just removed from the queue, but not processed).

There is a special case when the returned event is NULL (and the method returns TRUE), meaning that this event queue must finish its execution (i.e., quit the event loop),

event next event removed from the queue
TRUE if successful and false otherwise

Definition at line 481 of file EventQueue.cpp.

References Assert, BOOL, and NULL.

Referenced by processEventQueue().

    if (!event)
        return FALSE;

    *event = NULL;


#if defined (RT_OS_WINDOWS)

    MSG msg;
    BOOL rc = GetMessage (&msg, NULL, WM_USER, WM_USER);
    // check for error
    if (rc == -1)
        return FALSE;
    // check for WM_QUIT
    if (!rc)
        return TRUE;

    // retrieve our event
    *event = (Event *) msg.wParam;


    PLEvent *ev = NULL;
    HRESULT rc;

    mGotEvent = FALSE;

        rc = mEventQ->WaitForEvent (&ev);
        // check for error
        if (FAILED(rc))
            return FALSE;
        // check for EINTR signal
        if (!ev)
            return TRUE;

        // run PLEvent handler. This will just set mLastEvent if it is an
        // MyPLEvent instance, and then delete ev.
        mEventQ->HandleEvent (ev);
    while (!mGotEvent);

    // retrieve our event
    *event = mLastEvent;


    return TRUE;

Generated by  Doxygen 1.6.0   Back to index