VirtualBox

Changeset 28270 in vbox


Ignore:
Timestamp:
Apr 13, 2010 6:02:46 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
60012
Message:

Main/glue/AutoLock: add a wrapper for checking whether any lock of a class is held

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/com/AutoLock.h

    r26746 r28270  
    55
    66/*
    7  * Copyright (C) 2006-2009 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    8989void InitAutoLockSystem();
    9090
     91/**
     92 * Check whether the current thread holds any locks in the given class
     93 *
     94 * @return true if any such locks are held, false otherwise. If the lock
     95 *              validator is not compiled in, always returns false.
     96 * @param lockClass     Which lock class to check.
     97 */
     98bool AutoLockHoldsLocksInClass(VBoxLockingClass lockClass);
     99
    91100////////////////////////////////////////////////////////////////////////////////
    92101//
  • trunk/src/VBox/Main/glue/AutoLock.cpp

    r25939 r28270  
    55
    66/*
    7  * Copyright (C) 2006-2009 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    115115    AutoWriteLock lock2(critsect2 COMMA_LOCKVAL_SRC_POS);*/
    116116#endif
     117}
     118
     119bool AutoLockHoldsLocksInClass(VBoxLockingClass lockClass)
     120{
     121#ifdef VBOX_WITH_MAIN_LOCK_VALIDATION
     122    return RTLockValidatorHoldsLocksInClass(NIL_RTTHREAD,
     123                                            g_mapLockValidationClasses[lockClass]);
     124#else /* !VBOX_WITH_MAIN_LOCK_VALIDATION */
     125    return false;
     126#endif /* !VBOX_WITH_MAIN_LOCK_VALIDATION */
    117127}
    118128
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