![]() |
Kea 3.0.0
|
Interprocess Sync Class. More...
#include <interprocess_sync.h>
Public Member Functions | |
| InterprocessSync (const std::string &task_name) | |
| Constructor. | |
| virtual | ~InterprocessSync () |
| Destructor. | |
Protected Member Functions | |
| virtual bool | lock ()=0 |
| Acquire the lock (blocks if something else has acquired a lock on the same task name) | |
| virtual bool | tryLock ()=0 |
| Try to acquire a lock (doesn't block) | |
| virtual bool | unlock ()=0 |
| Release the lock. | |
Protected Attributes | |
| bool | is_locked_ |
| Is the lock taken? | |
| const std::string | task_name_ |
| The task name. | |
Friends | |
| class | InterprocessSyncLocker |
Interprocess Sync Class.
This class specifies an interface for mutual exclusion among co-operating processes. This is an abstract class and a real implementation such as InterprocessSyncFile should be used in code. Usage is as follows:
NOTE: All implementations of InterprocessSync should keep the is_locked_ member variable updated whenever their lock()/tryLock()/unlock() implementations are called.
Definition at line 38 of file interprocess_sync.h.
|
inline |
Constructor.
Creates an 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 52 of file interprocess_sync.h.
References is_locked_, and task_name_.
Referenced by isc::log::interprocess::InterprocessSyncFile::InterprocessSyncFile(), and isc::log::interprocess::InterprocessSyncNull::InterprocessSyncNull().
|
inlinevirtual |
Destructor.
Definition at line 57 of file interprocess_sync.h.
|
protectedpure virtual |
Acquire the lock (blocks if something else has acquired a lock on the same task name)
Implemented in isc::log::interprocess::InterprocessSyncFile, and isc::log::interprocess::InterprocessSyncNull.
|
protectedpure virtual |
Try to acquire a lock (doesn't block)
Implemented in isc::log::interprocess::InterprocessSyncFile, and isc::log::interprocess::InterprocessSyncNull.
|
protectedpure virtual |
Release the lock.
Implemented in isc::log::interprocess::InterprocessSyncFile, and isc::log::interprocess::InterprocessSyncNull.
|
friend |
Definition at line 42 of file interprocess_sync.h.
References InterprocessSyncLocker.
Referenced by InterprocessSyncLocker.
|
protected |
Is the lock taken?
Definition at line 77 of file interprocess_sync.h.
Referenced by InterprocessSync(), isc::log::interprocess::InterprocessSyncFile::lock(), isc::log::interprocess::InterprocessSyncNull::lock(), isc::log::interprocess::InterprocessSyncFile::tryLock(), isc::log::interprocess::InterprocessSyncNull::tryLock(), isc::log::interprocess::InterprocessSyncFile::unlock(), and isc::log::interprocess::InterprocessSyncNull::unlock().
|
protected |