VirtualBox

Changeset 106077 in vbox for trunk/src/VBox/Main/glue


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

Main: Name locks.

File:
1 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
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