VirtualBox

Changeset 28887 in vbox for trunk/src/VBox/Additions/common


Ignore:
Timestamp:
Apr 29, 2010 11:19:17 AM (15 years ago)
Author:
vboxsync
Message:

Guest Control/Main: Faster (no polling on guest side), free data on shutdown.

Location:
trunk/src/VBox/Additions/common
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibGuestCtrl.cpp

    r28800 r28887  
    110110    VBoxGuestCtrlHGCMMsgType Msg;
    111111
    112     Msg.hdr.u32Timeout = u32Timeout;
    113     Msg.hdr.fInterruptible = true;
    114 
    115     Msg.hdr.info.result = VERR_WRONG_ORDER;
    116     Msg.hdr.info.u32ClientID = u32ClientId;
    117     Msg.hdr.info.u32Function = GUEST_GET_HOST_MSG; /* Tell the host we want our next command. */
    118     Msg.hdr.info.cParms = 2;                       /* Just peek for the next message! */
     112    Msg.hdr.result = VERR_WRONG_ORDER;
     113    Msg.hdr.u32ClientID = u32ClientId;
     114    Msg.hdr.u32Function = GUEST_GET_HOST_MSG; /* Tell the host we want our next command. */
     115    Msg.hdr.cParms = 2;                       /* Just peek for the next message! */
    119116
    120117    VbglHGCMParmUInt32Set(&Msg.msg, 0);
    121118    VbglHGCMParmUInt32Set(&Msg.num_parms, 0);
    122119
    123     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL_TIMED(sizeof(Msg)), &Msg, sizeof(Msg));
     120    int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
    124121    if (RT_SUCCESS(rc))
    125122    {
     
    128125            rc = VbglHGCMParmUInt32Get(&Msg.num_parms, puNumParms);
    129126            if (RT_SUCCESS(rc))
    130                 rc = Msg.hdr.info.result;
     127                rc = Msg.hdr.result;
    131128                /* Ok, so now we know what message type and how much parameters there are. */
    132129    }
  • trunk/src/VBox/Additions/common/VBoxService/VBoxService.cpp

    r28800 r28887  
    298298{
    299299    int rc;
    300 
    301300    /*
    302301     * Initialize the services.
     
    314313            }
    315314        }
    316 
    317315    /*
    318316     * Start the service(s).
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp

    r28833 r28887  
    239239        VBoxServiceVerbose(4, "Control: Waiting for host msg ...\n");
    240240        rc = VbglR3GuestCtrlGetHostMsg(g_GuestControlSvcClientID, &uMsg, &uNumParms, 1000 /* 1s timeout */);
    241         if (rc == VERR_TOO_MUCH_DATA)
    242         {
    243             VBoxServiceVerbose(3, "Control: Message requires %ld parameters, but only 2 supplied -- retrying request ...\n", uNumParms);
    244             rc = VINF_SUCCESS;
    245         }
    246         else if (rc == VERR_TIMEOUT)
    247         {
    248             VBoxServiceVerbose(3, "Control: Wait timed out, waiting for next round ...\n");
    249             RTThreadSleep(100);
    250         }
     241        if (RT_FAILURE(rc))
     242        {
     243            if (rc == VERR_TOO_MUCH_DATA)
     244            {
     245                VBoxServiceVerbose(3, "Control: Message requires %ld parameters, but only 2 supplied -- retrying request ...\n", uNumParms);
     246                rc = VINF_SUCCESS; /* Try to get "real" message in next block below. */
     247            }
     248            else
     249                VBoxServiceVerbose(3, "Control: Getting host message failed with %Rrc\n", rc); /* VERR_GEN_IO_FAILURE seems to be normal if ran  into timeout. */
     250        }
     251
    251252        if (RT_SUCCESS(rc))
    252253        {
     
    272273        }
    273274
    274         /*
    275          * Block for a while.
    276          *
    277          * The event semaphore takes care of ignoring interruptions and it
    278          * allows us to implement service wakeup later.
    279          */
     275        /* Do we need to shutdown? */
    280276        if (*pfShutdown)
    281277        {
     
    283279            break;
    284280        }
    285         int rc2 = RTSemEventMultiWait(g_hControlEvent, g_ControlInterval);
    286         if (*pfShutdown)
    287         {
    288             rc = 0;
    289             break;
    290         }
    291         if (rc2 != VERR_TIMEOUT && RT_FAILURE(rc2))
    292         {
    293             VBoxServiceError("Control: RTSemEventMultiWait failed; rc2=%Rrc\n", rc2);
    294             rc = rc2;
    295             break;
    296         }
     281
     282        /* Let's sleep for a bit and let others run ... */
     283        RTThreadYield();
    297284    }
    298285
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