Kea 2.7.6
|
File-based Interprocess Sync Class. More...
#include <interprocess_sync_file.h>
Public Member Functions | |
InterprocessSyncFile (const std::string &task_name) | |
Constructor. | |
virtual | ~InterprocessSyncFile () |
Destructor. | |
Public Member Functions inherited from isc::log::interprocess::InterprocessSync | |
InterprocessSync (const std::string &task_name) | |
Constructor. | |
virtual | ~InterprocessSync () |
Destructor. | |
Protected Member Functions | |
bool | lock () |
Acquire the lock (blocks if something else has acquired a lock on the same task name) | |
bool | tryLock () |
Try to acquire a lock (doesn't block) | |
bool | unlock () |
Release the lock. | |
Protected Member Functions inherited from isc::log::interprocess::InterprocessSync |
Additional Inherited Members | |
Protected Attributes inherited from isc::log::interprocess::InterprocessSync | |
bool | is_locked_ |
Is the lock taken? | |
const std::string | task_name_ |
The task name. | |
File-based Interprocess Sync Class.
This class specifies a concrete implementation for a file-based interprocess synchronization mechanism. Please see the InterprocessSync class documentation for usage.
An InterprocessSyncFileError exception may be thrown if there is an issue opening the lock file.
Lock files are created typically in the local state directory (var). They are typically named like "<task_name>_lockfile". This implementation opens lock files lazily (only when necessary). It also leaves the lock files lying around as multiple processes may have locks on them.
Definition at line 42 of file interprocess_sync_file.h.
|
inline |
Constructor.
Creates a file-based interprocess synchronization object
task_name | Name of the synchronization task. This has to be identical among the various processes that need to be synchronized for the same task. |
Definition at line 51 of file interprocess_sync_file.h.
|
virtual |
Destructor.
Definition at line 31 of file interprocess_sync_file.cc.
|
protectedvirtual |
Acquire the lock (blocks if something else has acquired a lock on the same task name)
Implements isc::log::interprocess::InterprocessSync.
Definition at line 89 of file interprocess_sync_file.cc.
References isc::log::interprocess::InterprocessSync::is_locked_.
|
protectedvirtual |
Try to acquire a lock (doesn't block)
Implements isc::log::interprocess::InterprocessSync.
Definition at line 103 of file interprocess_sync_file.cc.
References isc::log::interprocess::InterprocessSync::is_locked_.
|
protectedvirtual |
Release the lock.
Implements isc::log::interprocess::InterprocessSync.
Definition at line 117 of file interprocess_sync_file.cc.
References isc::log::interprocess::InterprocessSync::is_locked_.