LLVM API Documentation
#include <Mutex.h>
Public Member Functions | |
Constructors | |
Mutex (bool recursive=true) | |
Default Constructor. | |
~Mutex (void) | |
Destructor. | |
Methods | |
bool | acquire () |
Unconditionally acquire the lock. | |
bool | release (void) |
Unconditionally release the lock. | |
bool | tryacquire () |
Try to acquire the lock. |
Definition at line 22 of file Mutex.h.
llvm::Mutex::Mutex | ( | bool | recursive = true |
) |
Default Constructor.
Initializes the lock but doesn't acquire it. if recursive
is set to false, the lock will not be recursive which makes it cheaper but also more likely to deadlock (same thread can't acquire more than once).
Definition at line 58 of file Mutex.cpp.
References llvm::pthread_enabled.
llvm::Mutex::~Mutex | ( | void | ) |
Destructor.
Releases and removes the lock
Definition at line 97 of file Mutex.cpp.
References llvm::pthread_enabled.
bool llvm::Mutex::acquire | ( | ) |
Unconditionally acquire the lock.
Attempts to unconditionally acquire the lock. If the lock is held by another thread, this method will wait until it can acquire the lock.
Definition at line 109 of file Mutex.cpp.
References llvm::pthread_enabled.
Referenced by llvm::MutexGuard::MutexGuard().
bool llvm::Mutex::release | ( | void | ) |
Unconditionally release the lock.
Attempts to release the lock. If the lock is held by the current thread, the lock is released allowing other threads to acquire the lock.
Definition at line 123 of file Mutex.cpp.
References llvm::pthread_enabled.
Referenced by llvm::MutexGuard::~MutexGuard().
bool llvm::Mutex::tryacquire | ( | ) |
Try to acquire the lock.
Attempts to acquire the lock without blocking. If the lock is not available, this function returns false quickly (without blocking). If the lock is available, it is acquired.
Definition at line 137 of file Mutex.cpp.
References llvm::pthread_enabled.