LLVM API Documentation

Public Member Functions
llvm::MutexGuard Class Reference

Guard a section of code with a Mutex. More...

#include <MutexGuard.h>

List of all members.

Public Member Functions

 MutexGuard (sys::Mutex &m)
 ~MutexGuard ()
bool holds (const sys::Mutex &lock) const

Detailed Description

Guard a section of code with a Mutex.

Instances of this class acquire a given Mutex Lock when constructed and hold that lock until destruction. The intention is to instantiate one of these on the stack at the top of some scope to be assured that C++ destruction of the object will always release the Mutex and thus avoid a host of nasty multi-threading problems in the face of exceptions, etc.

Definition at line 27 of file MutexGuard.h.


Constructor & Destructor Documentation

llvm::MutexGuard::MutexGuard ( sys::Mutex m) [inline]

Definition at line 32 of file MutexGuard.h.

References llvm::sys::SmartMutex< mt_only >::lock().

Definition at line 33 of file MutexGuard.h.

References llvm::sys::SmartMutex< mt_only >::unlock().


Member Function Documentation

bool llvm::MutexGuard::holds ( const sys::Mutex lock) const [inline]

holds - Returns true if this locker instance holds the specified lock. This is mostly used in assertions to validate that the correct mutex is held.

Definition at line 37 of file MutexGuard.h.


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