Logo Search packages:      
Sourcecode: virtualbox-ose version File versions

util::AutoMultiWriteLock2 Class Reference

#include <AutoLock.h>

Inheritance diagram for util::AutoMultiWriteLock2:

util::AutoMultiWriteLockBase< 2 >

List of all members.


Detailed Description

AutoMultiWriteLock for 2 locks.

The AutoMultiWriteLockN family of classes provides a possibility to manage several read/write semaphores at once. This is handy if all managed semaphores need to be locked and unlocked synchronously and will also help to avoid locking order errors.

The functionality of the AutoMultiWriteLockN class family is similar to the functionality of the AutoMultiLockN class family (see the AutoMultiLock2 class for details) with two important differences:

  1. Instances of AutoMultiWriteLockN classes are constructed from a list of LockHandle or Lockable arguments directly instead of getting intermediate LockOps interface pointers.
  2. All locks are requested in write mode.
  3. Since all locks are requested in write mode, bulk AutoMultiWriteLockBase::leave() and AutoMultiWriteLockBase::enter() operations are also available, that will leave and enter all managed semaphores at once in the proper order (similarly to AutoMultiWriteLockBase::lock() and AutoMultiWriteLockBase::unlock()).

Here is a typical usage pattern: ... LockHandle data1, data2; ... { AutoMultiWriteLock2 multiLock (&data1, &data2); // both locks are held in write mode here } // both locks are released here

Definition at line 1336 of file AutoLock.h.


Public Member Functions

 AutoMultiWriteLock2 (C(0), C(1))
 AutoMultiWriteLock2 (A(0), A(1))
void enter ()
void leave ()
void lock ()
void maybeEnter ()
void maybeLeave ()
void unlock ()

Protected Member Functions

void setLockHandle (size_t aIdx, LockHandle *aHandle)

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index