A thread-safe class for an inter-thread/inter-process lock. The lock mechanism is based on a locked file in the file system. The locked file is a file that may or may not already exist; if it doesn't, it is created. The file contents are not altered, and the file is not deleted. If the specified file is a directory, the lock is instead made on a file in that directory. All threads in the same process using the locker must do so through the same Locker object.
More...
#include <Locker.h>
A thread-safe class for an inter-thread/inter-process lock. The lock mechanism is based on a locked file in the file system. The locked file is a file that may or may not already exist; if it doesn't, it is created. The file contents are not altered, and the file is not deleted. If the specified file is a directory, the lock is instead made on a file in that directory. All threads in the same process using the locker must do so through the same Locker object.
The lock is initially open, and is closed by calling add_bolt() and reopened with remove_bolt(); add_bolt() can be called multiple times, with only the first instance having a real effect, and the lock being released when the last bolt is removed. It is recommended not to call add_bolt() directly, but to use the RAII pattern provided by the bolt() function.
◆ Locker()
sjef::util::Locker::Locker |
( |
fs::path |
path | ) |
|
|
explicit |
◆ ~Locker()
virtual sjef::util::Locker::~Locker |
( |
| ) |
|
|
virtual |
◆ add_bolt()
void sjef::util::Locker::add_bolt |
( |
| ) |
|
◆ bolt()
Bolt sjef::util::Locker::bolt |
( |
| ) |
|
◆ path()
const fs::path& sjef::util::Locker::path |
( |
| ) |
const |
|
inline |
◆ remove_bolt()
void sjef::util::Locker::remove_bolt |
( |
| ) |
|
The documentation for this class was generated from the following file: