LLVM 22.0.0git
|
A synchronization primitive with weak mutual exclusion guarantees. More...
#include "llvm/Support/AdvisoryLock.h"
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.
|
virtualdefault |
Unlocks the lock if its ownership was previously acquired by tryLock()
.
Tries to acquire ownership of the lock without blocking.
Error
in case of an unexpected failure. Implemented in llvm::LockFileManager.
|
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.
|
pure virtual |
For a lock owned by someone else, wait until it is unlocked.
MaxSeconds | the maximum total wait time in seconds. |
Implemented in llvm::LockFileManager.