VirtualBox

Ignore:
Timestamp:
Aug 30, 2007 7:50:15 PM (17 years ago)
Author:
vboxsync
Message:

Tuned the message loop for faster responds time

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/VBoxService/VBoxService.cpp

    r4302 r4452  
    337337    while(true)
    338338    {
    339         DWORD waitResult = MsgWaitForMultipleObjectsEx(1, &gStopSem, 500, QS_ALLINPUT, 0);
     339        DWORD waitResult = MsgWaitForMultipleObjectsEx(1, &gStopSem, 100, QS_ALLINPUT, 0);
    340340        if (waitResult == WAIT_OBJECT_0)
    341341        {
     
    344344            break;
    345345        }
    346         else if (waitResult == WAIT_OBJECT_0 + 1)
    347         {
    348             /* a window message, handle it */
    349             MSG msg;
    350             while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
    351             {
    352                 dprintf(("VBoxService: msg %p\n", msg.message));
    353                 if (msg.message == WM_QUIT)
    354                 {
    355                     dprintf(("VBoxService: WM_QUIT!\n"));
    356                     SetEvent(gStopSem);
    357                     continue;
    358                 }
    359                 TranslateMessage(&msg);
    360                 DispatchMessage(&msg);
    361             }
    362         }
    363         else /* timeout */
    364         {
    365 #ifndef DEBUG_sandervl
    366             dprintf(("VBoxService: timed out\n"));
    367 #endif
    368             /* we might have to repeat this operation because the shell might not be loaded yet */
    369             if (!fTrayIconCreated)
    370             {
    371                 fTrayIconCreated = Shell_NotifyIcon(NIM_ADD, &ndata);
    372                 dprintf(("VBoxService: fTrayIconCreated = %d, err %08X\n", fTrayIconCreated, GetLastError ()));
    373             }
     346        /* timeout or a window message, handle it */
     347        MSG msg;
     348        while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
     349        {
     350            dprintf(("VBoxService: msg %p\n", msg.message));
     351            if (msg.message == WM_QUIT)
     352            {
     353                dprintf(("VBoxService: WM_QUIT!\n"));
     354                SetEvent(gStopSem);
     355                continue;
     356            }
     357            TranslateMessage(&msg);
     358            DispatchMessage(&msg);
     359        }
     360        /* we might have to repeat this operation because the shell might not be loaded yet */
     361        if (!fTrayIconCreated)
     362        {
     363            fTrayIconCreated = Shell_NotifyIcon(NIM_ADD, &ndata);
     364            dprintf(("VBoxService: fTrayIconCreated = %d, err %08X\n", fTrayIconCreated, GetLastError ()));
    374365        }
    375366    }
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