VirtualBox

Changeset 23092 in vbox for trunk/include/VBox


Ignore:
Timestamp:
Sep 17, 2009 1:20:18 PM (15 years ago)
Author:
vboxsync
Message:

Main/glue: EventQueue bugfixes and code style adjustments and cleanups. Windows was polling instead of waiting and processEventQueue didn't return what it should on all platforms (nobody uses it currently, so that didn't break anything). Tested on 64-bit linux, 64-bit windows and 32-bit darwin.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/com/EventQueue.h

    r22911 r23092  
    3333
    3434#if !defined (VBOX_WITH_XPCOM)
    35 #include <windows.h>
     35# include <Windows.h>
    3636#else
    37 #include <nsEventQueueUtils.h>
     37# include <nsEventQueueUtils.h>
    3838#endif
    3939
     
    7777 *  Simple event queue.
    7878 *
    79  *  On Linux, if this queue is created on the main thread, it automatically
    80  *  processes XPCOM/IPC events while waiting for its own (Event) events.
     79 *  When using XPCOM, this will map onto the default XPCOM queue for the thread.
     80 *  So, if a queue is created on the main thread, it automatically processes
     81 *  XPCOM/IPC events while waiting for its own (Event) events.
     82 *
     83 *  When using Windows, Darwin and OS/2, this will map onto the native thread
     84 *  queue/runloop.  So, windows messages and want not will be processed while
     85 *  waiting for events.
    8186 */
    8287class EventQueue
     
    9095    BOOL waitForEvent (Event **event);
    9196    BOOL handleEvent (Event *event);
    92     /**
    93      * Process events pending on this event queue, and wait
    94      * up to given timeout, if nothing is available.
    95      * Must be called on same thread this event queue was created on.
    96      */
    9797    int processEventQueue(uint32_t cMsTimeout);
    98     /**
    99      * Interrupt thread waiting on event queue processing.
    100      * Can be called on any thread.
    101      */
    10298    int interruptEventQueueProcessing();
    103     /**
    104      * Get select()'able selector for this event queue, can be -1
    105      * on platforms not supporting such functionality.
    106      */
    10799    int getSelectFD();
    108     /**
    109      * Initialize/deinitialize event queues.
    110      */
    111100    static int init();
    112     static int deinit();
    113     /**
    114      * Get main event queue instance.
    115      */
    116     static EventQueue* getMainEventQueue();
     101    static int uninit();
     102    static EventQueue *getMainEventQueue();
    117103
    118104private:
    119     static EventQueue* mMainQueue;
     105    static EventQueue *mMainQueue;
    120106
    121107#if !defined (VBOX_WITH_XPCOM)
    122108
     109    /** The thread which the queue belongs to. */
    123110    DWORD mThreadId;
     111    /** Duplicated thread handle for MsgWaitForMultipleObjects. */
     112    HANDLE mhThread;
    124113
    125114#else
    126115
     116    /** Whether it was created (and thus needs destroying) or if a queue already
     117     *  associated with the thread was used. */
    127118    BOOL mEQCreated;
    128119
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette