VirtualBox

Changeset 75987 in vbox for trunk/src


Ignore:
Timestamp:
Dec 5, 2018 5:43:04 PM (6 years ago)
Author:
vboxsync
Message:

GuestProperties: ASYNC_HOST_NOTIFY cleanup.

File:
1 edited

Legend:

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

    r75986 r75987  
    6060#include <list>
    6161
    62 /** @todo Delete the old !ASYNC_HOST_NOTIFY code and remove this define. */
    63 #define ASYNC_HOST_NOTIFY
    6462
    6563namespace guestProp {
     
    321319        , mcTimestampAdjustments(0)
    322320        , m_fSetHostVersionProps(false)
    323 #ifdef ASYNC_HOST_NOTIFY
    324321        , mhThreadNotifyHost(NIL_RTTHREAD)
    325322        , mhReqQNotifyHost(NIL_RTREQQUEUE)
    326 #endif
    327323    { }
    328324
     
    441437    static DECLCALLBACK(void) dbgInfo(void *pvUser, PCDBGFINFOHLP pHlp, const char *pszArgs);
    442438
    443 #ifdef ASYNC_HOST_NOTIFY
    444439    /* Thread for handling host notifications. */
    445440    RTTHREAD mhThreadNotifyHost;
     
    447442    RTREQQUEUE mhReqQNotifyHost;
    448443    static DECLCALLBACK(int) threadNotifyHost(RTTHREAD self, void *pvUser);
    449 #endif
    450444
    451445    DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(Service);
     
    13071301}
    13081302
    1309 #ifdef ASYNC_HOST_NOTIFY
    1310 static DECLCALLBACK(void) notifyHostAsyncWorker(PFNHGCMSVCEXT pfnHostCallback,
    1311                                                 void *pvHostData,
    1312                                                 PGUESTPROPHOSTCALLBACKDATA pHostCallbackData)
    1313 {
    1314     pfnHostCallback(pvHostData, 0 /*u32Function*/,
    1315                    (void *)pHostCallbackData,
    1316                    sizeof(GUESTPROPHOSTCALLBACKDATA));
     1303static DECLCALLBACK(void)
     1304notifyHostAsyncWorker(PFNHGCMSVCEXT pfnHostCallback, void *pvHostData, PGUESTPROPHOSTCALLBACKDATA pHostCallbackData)
     1305{
     1306    pfnHostCallback(pvHostData, 0 /*u32Function*/, (void *)pHostCallbackData, sizeof(GUESTPROPHOSTCALLBACKDATA));
    13171307    RTMemFree(pHostCallbackData);
    13181308}
    1319 #endif
    13201309
    13211310/**
     
    13301319{
    13311320    LogFlowFunc(("pszName=%s, pszValue=%s, nsTimestamp=%llu, pszFlags=%s\n", pszName, pszValue, nsTimestamp, pszFlags));
    1332 #ifdef ASYNC_HOST_NOTIFY
    1333     int rc = VINF_SUCCESS;
     1321    int rc;
    13341322
    13351323    /* Allocate buffer for the callback data and strings. */
     
    13751363        rc = VERR_NO_MEMORY;
    13761364    }
    1377 #else
    1378     GUESTPROPHOSTCALLBACKDATA HostCallbackData;
    1379     HostCallbackData.u32Magic     = GUESTPROPHOSTCALLBACKDATA_MAGIC;
    1380     HostCallbackData.pcszName     = pszName;
    1381     HostCallbackData.pcszValue    = pszValue;
    1382     HostCallbackData.nsTimestamp  = nsTimestamp;
    1383     HostCallbackData.pcszFlags    = pszFlags;
    1384     int rc = mpfnHostCallback(mpvHostData, 0 /*u32Function*/,
    1385                               (void *)(&HostCallbackData),
    1386                               sizeof(HostCallbackData));
    1387 #endif
    13881365    LogFlowFunc(("returning rc=%Rrc\n", rc));
    13891366    return rc;
     
    16981675
    16991676
    1700 #ifdef ASYNC_HOST_NOTIFY
    1701 
    17021677/* static */
    17031678DECLCALLBACK(int) Service::threadNotifyHost(RTTHREAD hThreadSelf, void *pvUser)
     
    17321707}
    17331708
    1734 #endif /* ASYNC_HOST_NOTIFY */
    17351709
    17361710int Service::initialize()
     
    17601734    }
    17611735
    1762 #ifdef ASYNC_HOST_NOTIFY
    17631736    /* The host notification thread and queue. */
    17641737    int rc = RTReqQueueCreate(&mhReqQNotifyHost);
     
    17721745                            RTTHREADFLAGS_WAITABLE,
    17731746                            "GSTPROPNTFY");
    1774     }
    1775 
    1776     if (RT_FAILURE(rc))
    1777     {
    1778         if (mhReqQNotifyHost != NIL_RTREQQUEUE)
    1779         {
    1780             RTReqQueueDestroy(mhReqQNotifyHost);
    1781             mhReqQNotifyHost = NIL_RTREQQUEUE;
    1782         }
    1783     }
    1784 #else  /* !ASYNC_HOST_NOTIFY */
    1785     int rc = VINF_SUCCESS;
    1786 #endif /* !ASYNC_HOST_NOTIFY */
    1787 
    1788     /* Finally debug stuff (ignore failures): */
    1789     if (RT_SUCCESS(rc))
    1790         HGCMSvcHlpInfoRegister(mpHelpers, "guestprops", "Display the guest properties", Service::dbgInfo, this);
    1791 
     1747        if (RT_SUCCESS(rc))
     1748        {
     1749            /* Finally debug stuff (ignore failures): */
     1750            HGCMSvcHlpInfoRegister(mpHelpers, "guestprops", "Display the guest properties", Service::dbgInfo, this);
     1751            return rc;
     1752        }
     1753
     1754        RTReqQueueDestroy(mhReqQNotifyHost);
     1755        mhReqQNotifyHost = NIL_RTREQQUEUE;
     1756    }
    17921757    return rc;
    17931758}
    17941759
    1795 #ifdef ASYNC_HOST_NOTIFY
    17961760/**
    17971761 * @callback_method_impl{FNRTSTRSPACECALLBACK, Destroys Property.}
     
    18051769}
    18061770
    1807 #endif
    18081771
    18091772int Service::uninit()
     
    18121775        HGCMSvcHlpInfoDeregister(mpHelpers, "guestprops");
    18131776
    1814 #ifdef ASYNC_HOST_NOTIFY
    18151777    if (mhReqQNotifyHost != NIL_RTREQQUEUE)
    18161778    {
     
    18291791        mhProperties = NULL;
    18301792    }
    1831 #endif
    18321793    return VINF_SUCCESS;
    18331794}
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