CatapultServer
v0.5.0.1 (Elephant)
|
Lock based on an underlying lock file. More...
Public Types | |
using | FdType = int |
Public Member Functions | |
FileLock (const std::string &lockFilePath) | |
Creates a lock file with path lockFilePath. More... | |
~FileLock () | |
Releases the lock file. More... | |
void | lock () |
Blocks until a lock can be obtained for the current execution agent. More... | |
bool | try_lock () |
Attempts to acquire the lock for the current execution agent without blocking. More... | |
void | unlock () noexcept |
Releases the lock held by the execution agent. Throws no exceptions. More... | |
Public Member Functions inherited from catapult::utils::NonCopyable | |
constexpr | NonCopyable ()=default |
Default constructor. More... | |
~NonCopyable ()=default | |
Default destructor. More... | |
NonCopyable (const NonCopyable &)=delete | |
Disabled copy constructor. More... | |
NonCopyable & | operator= (const NonCopyable &)=delete |
Disabled assignment operator. More... | |
Private Attributes | |
std::string | m_lockFilePath |
utils::SpinLock | m_spinLock |
FdType | m_fd |
Lock based on an underlying lock file.
using catapult::io::FileLock::FdType = int |
Implementation dependent type of file descriptor.
|
explicit |
Creates a lock file with path lockFilePath.
catapult::io::FileLock::~FileLock | ( | ) |
Releases the lock file.
void catapult::io::FileLock::lock | ( | ) |
Blocks until a lock can be obtained for the current execution agent.
bool catapult::io::FileLock::try_lock | ( | ) |
Attempts to acquire the lock for the current execution agent without blocking.
|
noexcept |
Releases the lock held by the execution agent. Throws no exceptions.
|
private |
|
private |
|
private |