VirtualBox

Changeset 106077 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Sep 17, 2024 7:36:17 PM (3 months ago)
Author:
vboxsync
Message:

Main: Name locks.

Location:
trunk/src/VBox/Main
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/glue/AutoLock.cpp

    r106061 r106077  
    168168};
    169169
    170 RWLockHandle::RWLockHandle(VBoxLockingClass lockClass)
    171 {
     170RWLockHandle::RWLockHandle(VBoxLockingClass lockClass, const char *pszName /*= NULL*/)
     171{
     172    Assert(!pszName || (!strchr(pszName, '%') && *pszName));
    172173    m = new Data();
    173174
    174175    m->lockClass = lockClass;
    175176#ifdef VBOX_WITH_MAIN_LOCK_VALIDATION
    176     m->strDescription.printf("r/w %RCv", this);
     177    if (pszName)
     178        m->strDescription.printf("r/w %RCv %s", this, pszName);
     179    else
     180        m->strDescription.printf("r/w %RCv", this);
    177181#endif
    178182
    179183#ifdef GLUE_USE_CRITSECTRW
    180184# ifdef VBOX_WITH_MAIN_LOCK_VALIDATION
    181     int vrc = RTCritSectRwInitEx(&m->CritSect, 0 /*fFlags*/, g_mapLockValidationClasses[lockClass], RTLOCKVAL_SUB_CLASS_ANY, NULL);
     185    int vrc = RTCritSectRwInitEx(&m->CritSect, 0 /*fFlags*/, g_mapLockValidationClasses[lockClass], RTLOCKVAL_SUB_CLASS_ANY, pszName);
    182186# else
    183     int vrc = RTCritSectRwInitEx(&m->CritSect, 0 /*fFlags*/, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_ANY, NULL);
     187    int vrc = RTCritSectRwInitEx(&m->CritSect, 0 /*fFlags*/, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_ANY, pszName);
    184188# endif
    185189#else
    186190# ifdef VBOX_WITH_MAIN_LOCK_VALIDATION
    187     int vrc = RTSemRWCreateEx(&m->sem, 0 /*fFlags*/, g_mapLockValidationClasses[lockClass], RTLOCKVAL_SUB_CLASS_ANY, NULL);
     191    int vrc = RTSemRWCreateEx(&m->sem, 0 /*fFlags*/, g_mapLockValidationClasses[lockClass], RTLOCKVAL_SUB_CLASS_ANY, pszName);
    188192# else
    189     int vrc = RTSemRWCreateEx(&m->sem, 0 /*fFlags*/, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_ANY, NULL);
     193    int vrc = RTSemRWCreateEx(&m->sem, 0 /*fFlags*/, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_ANY, pszName);
    190194# endif
    191195#endif
  • trunk/src/VBox/Main/src-all/VirtualBoxBase.cpp

    r106061 r106077  
    195195    // getLockingClass() is overridden by many subclasses to return
    196196    // one of the locking classes listed at the top of AutoLock.h
    197     RWLockHandle *objLock = new RWLockHandle(getLockingClass());
     197    // getComponentName() returns the class name by default.
     198    RWLockHandle *objLock = new RWLockHandle(getLockingClass(), getComponentName());
    198199    if (!ASMAtomicCmpXchgPtr(&mObjectLock, objLock, NULL))
    199200    {
  • trunk/src/VBox/Main/src-all/VirtualBoxTranslator.cpp

    r106061 r106077  
    147147
    148148VirtualBoxTranslator::VirtualBoxTranslator()
    149     : util::RWLockHandle(util::LOCKCLASS_TRANSLATOR)
     149    : util::RWLockHandle(util::LOCKCLASS_TRANSLATOR, "VirtualBoxTranslator")
    150150    , m_cInstanceRefs(0)
    151151    , m_pDefaultComponent(NULL)
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r106061 r106077  
    431431#endif
    432432    , mBusMgr(NULL)
    433     , mLedLock(LOCKCLASS_LISTOFOTHEROBJECTS /* must be higher than LOCKCLASS_OTHEROBJECT */)
     433    , mLedLock(LOCKCLASS_LISTOFOTHEROBJECTS /* must be higher than LOCKCLASS_OTHEROBJECT */, "LedLock")
    434434    , muLedGen(0)
    435435    , muLedTypeGen(0)
  • trunk/src/VBox/Main/src-server/ClientWatcher.cpp

    r106061 r106077  
    5555
    5656VirtualBox::ClientWatcher::ClientWatcher() :
    57     mLock(LOCKCLASS_OBJECTSTATE)
     57    mLock(LOCKCLASS_OBJECTSTATE, "ClientWatcher")
    5858{
    5959    AssertReleaseFailed();
     
    9292    mThread(NIL_RTTHREAD),
    9393    mUpdateReq(CWUPDATEREQARG),
    94     mLock(LOCKCLASS_OBJECTSTATE)
     94    mLock(LOCKCLASS_OBJECTSTATE, "ClientWatcher")
    9595{
    9696#if defined(RT_OS_WINDOWS)
  • trunk/src/VBox/Main/src-server/MediumImpl.cpp

    r106061 r106077  
    178178          readers(0),
    179179          preLockState(MediumState_NotCreated),
    180           queryInfoSem(LOCKCLASS_MEDIUMQUERY),
     180          queryInfoSem(LOCKCLASS_MEDIUMQUERY, "queryInfoSem"),
    181181          queryInfoRunning(false),
    182182          type(MediumType_Normal),
  • trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp

    r106061 r106077  
    293293        , uuidMediaRegistry("48024e5c-fdd9-470f-93af-ec29f7ea518c")
    294294        , uRegistryNeedsSaving(0)
    295         , lockMachines(LOCKCLASS_LISTOFMACHINES)
     295        , lockMachines(LOCKCLASS_LISTOFMACHINES, "Machines")
    296296        , allMachines(lockMachines)
    297         , lockGuestOSTypes(LOCKCLASS_LISTOFOTHEROBJECTS)
     297        , lockGuestOSTypes(LOCKCLASS_LISTOFOTHEROBJECTS, "GuestOSTypes")
    298298        , allGuestOSTypes(lockGuestOSTypes)
    299         , lockMedia(LOCKCLASS_LISTOFMEDIA)
     299        , lockMedia(LOCKCLASS_LISTOFMEDIA, "Media")
    300300        , allHardDisks(lockMedia)
    301301        , allDVDImages(lockMedia)
    302302        , allFloppyImages(lockMedia)
    303         , lockSharedFolders(LOCKCLASS_LISTOFOTHEROBJECTS)
     303        , lockSharedFolders(LOCKCLASS_LISTOFOTHEROBJECTS, "SharedFolders")
    304304        , allSharedFolders(lockSharedFolders)
    305         , lockDHCPServers(LOCKCLASS_LISTOFOTHEROBJECTS)
     305        , lockDHCPServers(LOCKCLASS_LISTOFOTHEROBJECTS, "DHCPServers")
    306306        , allDHCPServers(lockDHCPServers)
    307         , lockNATNetworks(LOCKCLASS_LISTOFOTHEROBJECTS)
     307        , lockNATNetworks(LOCKCLASS_LISTOFOTHEROBJECTS, "NATNetworks")
    308308        , allNATNetworks(lockNATNetworks)
    309309#ifdef VBOX_WITH_VMNET
    310         , lockHostOnlyNetworks(LOCKCLASS_LISTOFOTHEROBJECTS)
     310        , lockHostOnlyNetworks(LOCKCLASS_LISTOFOTHEROBJECTS, "HostOnlyNetworks")
    311311        , allHostOnlyNetworks(lockHostOnlyNetworks)
    312312#endif /* VBOX_WITH_VMNET */
    313313#ifdef VBOX_WITH_CLOUD_NET
    314         , lockCloudNetworks(LOCKCLASS_LISTOFOTHEROBJECTS)
     314        , lockCloudNetworks(LOCKCLASS_LISTOFOTHEROBJECTS, "CloudNetworks")
    315315        , allCloudNetworks(lockCloudNetworks)
    316316#endif /* VBOX_WITH_CLOUD_NET */
    317         , mtxProgressOperations(LOCKCLASS_PROGRESSLIST)
     317        , mtxProgressOperations(LOCKCLASS_PROGRESSLIST, "ProgressOperations")
    318318        , pClientWatcher(NULL)
    319319        , threadAsyncEvent(NIL_RTTHREAD)
     
    558558        sAPIVersion = VBOX_API_VERSION_STRING;
    559559    if (!spMtxNatNetworkNameToRefCountLock)
    560         spMtxNatNetworkNameToRefCountLock = new RWLockHandle(LOCKCLASS_VIRTUALBOXOBJECT);
     560        spMtxNatNetworkNameToRefCountLock = new RWLockHandle(LOCKCLASS_VIRTUALBOXOBJECT, "spMtxNatNetworkNameToRefCountLock");
    561561
    562562    LogFlowThisFunc(("Version: %s, Package: %s, API Version: %s\n", sVersion.c_str(), sPackageType.c_str(), sAPIVersion.c_str()));
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