LLVM API Documentation
Guard a section of code with a Mutex. More...
#include <MutexGuard.h>
Public Member Functions | |
MutexGuard (sys::Mutex &m) | |
~MutexGuard () | |
bool | holds (const sys::Mutex &lock) const |
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.
llvm::MutexGuard::MutexGuard | ( | sys::Mutex & | m | ) | [inline] |
Definition at line 32 of file MutexGuard.h.
References llvm::sys::SmartMutex< mt_only >::lock().
llvm::MutexGuard::~MutexGuard | ( | ) | [inline] |
Definition at line 33 of file MutexGuard.h.
References llvm::sys::SmartMutex< mt_only >::unlock().
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.