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

RTLock Class Reference
[RTLock - Scope-based Locking (C++).]

#include <lock.h>

List of all members.

Detailed Description

The stack object for automatic locking and unlocking.

This is a helper class for automatic locks, to simplify requesting a RTLockMtx and to not forget releasing it. To request a RTLockMtx, simply create an instance of RTLock on the stack and pass the mutex to it:

    extern RTLockMtx gMtx;     // wherever this is
    if (...)
        RTLock lock(gMtx);
        ... // do stuff
        // when lock goes out of scope, destructor releases the mutex

You can also explicitly release the mutex by calling RTLock::release(). This might be helpful if the lock doesn't go out of scope early enough for your mutex to be released.

Definition at line 109 of file lock.h.

Public Member Functions

void release ()
 RTLock (RTLockMtx &aMtx)

Private Attributes

bool mfLocked

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

Generated by  Doxygen 1.6.0   Back to index