VirtualBox

Changeset 3329 in vbox


Ignore:
Timestamp:
Jun 29, 2007 4:31:29 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
22471
Message:

Main: Added AutoLock::maybeRlock()/maybeWlock() in order for conditional locking in AutoMultiLock (lockable objects may be NULL in which case the lock will be a no-op).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/AutoLock.h

    r2981 r3329  
    270270    }
    271271
     272    /**
     273     *  Returns a tag to lock the given Lockable for reading by AutoMultiLock.
     274     *  Shortcut to |aL->lockHandle()->rlock()|.
     275     *  The returned tag is a no-op when @a aL is |NULL|.
     276     */
     277    static internal::LockableTag maybeRlock (Lockable *aL);
     278
     279    /**
     280     *  Returns a tag to lock the given Lockable for writing by AutoMultiLock.
     281     *  Shortcut to |aL->lockHandle()->wlock()|.
     282     *  The returned tag is a no-op when @a aL is |NULL|.
     283     */
     284    static internal::LockableTag maybeWlock (Lockable *aL);
     285
    272286private:
    273287
     
    346360{
    347361    return internal::LockableTag (lockHandle(), 'w');
     362}
     363
     364/* static */
     365inline internal::LockableTag AutoLock::maybeRlock (AutoLock::Lockable *aL)
     366{
     367    return internal::LockableTag (aL ? aL->lockHandle() : NULL, 'r');
     368}
     369
     370/* static */
     371inline internal::LockableTag AutoLock::maybeWlock (AutoLock::Lockable *aL)
     372{
     373    return internal::LockableTag (aL ? aL->lockHandle() : NULL, 'w');
    348374}
    349375
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