VirtualBox

Ignore:
Timestamp:
May 12, 2010 9:50:16 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
61556
Message:

Guest Control/VBoxService: Added support for cancel pending (blocking) calls; added support for properly stopping + shutting down main thread.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/GuestControl/service.cpp

    r29220 r29438  
    220220    int sendHostCmdToGuest(HostCmd *pCmd, VBOXHGCMCALLHANDLE callHandle, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
    221221    int retrieveNextHostCmd(uint32_t u32ClientID, VBOXHGCMCALLHANDLE callHandle, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
     222    int cancelPendingWaits(uint32_t u32ClientID);
    222223    int notifyHost(uint32_t eFunction, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
    223224    int processHostCmd(uint32_t eFunction, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
     
    443444}
    444445
     446int Service::cancelPendingWaits(uint32_t u32ClientID)
     447{
     448    int rc = VINF_SUCCESS;
     449    CallListIter it = mClientList.begin();
     450    while (it != mClientList.end())
     451    {
     452        if (it->mClientID == u32ClientID)
     453        {       
     454            if (it->mNumParms >= 2)
     455            {
     456                it->mParms[0].setUInt32(GETHOSTMSG_EXEC_HOST_CANCEL_WAIT); /* Message ID */
     457                it->mParms[1].setUInt32(0);                                /* Required parameters for message */
     458            }             
     459            if (mpHelpers)
     460                mpHelpers->pfnCallComplete(it->mHandle, rc);     
     461            it = mClientList.erase(it);
     462        }
     463        else
     464            it++;
     465    }
     466    return rc;
     467}
     468
    445469int Service::notifyHost(uint32_t eFunction, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
    446470{
     
    503527
    504528            /* In any case the client did something, so wake up and remove from list. */
     529            AssertPtr(mpHelpers);
    505530            mpHelpers->pfnCallComplete(guest.mHandle, rc);
    506531            mClientList.pop_front();                       
     
    559584                break;
    560585
     586            case GUEST_CANCEL_PENDING_WAITS:
     587                LogFlowFunc(("GUEST_CANCEL_PENDING_WAITS\n"));
     588                rc = cancelPendingWaits(u32ClientID);
     589                break;
     590
    561591            /* The guest notifies the host that some output at stdout/stderr is available. */
    562592            case GUEST_EXEC_SEND_OUTPUT:
     
    578608        {
    579609            /* Tell the client that the call is complete (unblocks waiting). */
     610            AssertPtr(mpHelpers);
    580611            mpHelpers->pfnCallComplete(callHandle, rc);
    581612        }
Note: See TracChangeset for help on using the changeset viewer.

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