LLVM
8.0.1
|
Platform agnostic Mutex class. More...
#include "llvm/Support/Mutex.h"
Public Member Functions | |
Constructors | |
MutexImpl (bool recursive=true) | |
Initializes the lock but doesn't acquire it. More... | |
~MutexImpl () | |
Releases and removes the lock Destructor. More... | |
Methods | |
bool | acquire () |
Attempts to unconditionally acquire the lock. More... | |
bool | release () |
Attempts to release the lock. More... | |
bool | tryacquire () |
Attempts to acquire the lock without blocking. More... | |
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). Default Constructor.
Definition at line 45 of file Mutex.cpp.
References assert(), and llvm::safe_malloc().
llvm::MutexImpl::~MutexImpl | ( | ) |
bool llvm::MutexImpl::acquire | ( | ) |
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 86 of file Mutex.cpp.
References assert().
Referenced by llvm::sys::SmartMutex< false >::lock().
bool llvm::MutexImpl::release | ( | ) |
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 96 of file Mutex.cpp.
References assert().
Referenced by llvm::sys::SmartMutex< false >::unlock().
bool llvm::MutexImpl::tryacquire | ( | ) |
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 106 of file Mutex.cpp.
References assert().
Referenced by llvm::sys::SmartMutex< false >::try_lock().