LLVM: llvm::AdvisoryLock Class Reference (original) (raw)
A synchronization primitive with weak mutual exclusion guarantees. More...
#include "[llvm/Support/AdvisoryLock.h](AdvisoryLock%5F8h%5Fsource.html)"
| Public Member Functions | |
|---|---|
| virtual Expected< bool > | tryLock ()=0 |
| Tries to acquire ownership of the lock without blocking. | |
| virtual WaitForUnlockResult | waitForUnlockFor (std::chrono::seconds MaxSeconds)=0 |
| For a lock owned by someone else, wait until it is unlocked. | |
| virtual std::error_code | unsafeMaybeUnlock ()=0 |
| For a lock owned by someone else, unlock it. | |
| virtual | ~AdvisoryLock ()=default |
| Unlocks the lock if its ownership was previously acquired by tryLock(). |
A synchronization primitive with weak mutual exclusion guarantees.
Implementations of this interface may allow multiple threads/processes to acquire the ownership of the lock simultaneously. Typically, threads/processes waiting for the lock to be unlocked will validate that the computation was performed by the expected thread/process and re-run the computation if not.
Definition at line 33 of file AdvisoryLock.h.
| virtual llvm::AdvisoryLock::~AdvisoryLock ( ) | virtualdefault |
|---|
Unlocks the lock if its ownership was previously acquired by [tryLock()](#a84d10827dab9633b1d012deae581fd81 "Tries to acquire ownership of the lock without blocking.").
◆ tryLock()
| virtual Expected< bool > llvm::AdvisoryLock::tryLock ( ) | pure virtual |
|---|
Tries to acquire ownership of the lock without blocking.
Returns
true if ownership of the lock was acquired successfully, false if the lock is already owned by someone else, or [Error](classllvm%5F1%5F1Error.html "Lightweight error class with error context and mandatory checking.") in case of an unexpected failure.
Implemented in llvm::LockFileManager.
◆ unsafeMaybeUnlock()
| virtual std::error_code llvm::AdvisoryLock::unsafeMaybeUnlock ( ) | pure virtual |
|---|
For a lock owned by someone else, unlock it.
A permitted side-effect is that another thread/process may acquire ownership of the lock before the existing owner unlocks it. This is an unsafe operation.
Implemented in llvm::LockFileManager.
◆ waitForUnlockFor()
| virtual WaitForUnlockResult llvm::AdvisoryLock::waitForUnlockFor ( std::chrono::seconds MaxSeconds) | pure virtual |
|---|
For a lock owned by someone else, wait until it is unlocked.
Parameters
| MaxSeconds | the maximum total wait time in seconds. |
|---|
Implemented in llvm::LockFileManager.
The documentation for this class was generated from the following file:
- include/llvm/Support/AdvisoryLock.h