libzypp
13.10.6
|
Inter process scoped lock implementation. More...
#include <InterProcessMutex.h>
Classes | |
class | Options |
options to alter the mutex behavor More... | |
Public Types | |
enum | ConsumerType { Reader, Writer } |
Processes can be of two types Reader or Writer. More... | |
Public Member Functions | |
InterProcessMutex (const Options &poptions) | |
Creates a mutex with a name and a timeout. More... | |
~InterProcessMutex () | |
Destructor, gives up the lock on the named resource. More... | |
Private Member Functions | |
bool | isProcessRunning (pid_t pid_r) |
Pathname | lockFilePath () const |
Private Attributes | |
shared_ptr< Fd > | _fd |
Options | _options |
Inter process scoped lock implementation.
This mutex will allow only one writer process to reach a critical region protected by a mutex of the same name, if there are no readers at the same time.
Multiple readers are allowed if there is no currently a writer.
Definition at line 43 of file InterProcessMutex.h.
Processes can be of two types Reader or Writer.
Enumerator | |
---|---|
Reader | |
Writer |
Definition at line 50 of file InterProcessMutex.h.
zypp::base::InterProcessMutex::InterProcessMutex | ( | const Options & | poptions | ) |
Creates a mutex with a name and a timeout.
default timeout is -1 which means no timeout at all, and the mutex will wait forever if other process is accessing the critical region for a mutex in with the same name.
If the timeout is 0, then if the lock is acquired an exception will be thrown inmediately.
Otherwise, the timeout exception will come after the timeout is reached.
Definition at line 55 of file InterProcessMutex.cc.
zypp::base::InterProcessMutex::~InterProcessMutex | ( | ) |
Destructor, gives up the lock on the named resource.
Definition at line 284 of file InterProcessMutex.cc.
|
private |
Definition at line 318 of file InterProcessMutex.cc.
|
private |
Definition at line 312 of file InterProcessMutex.cc.
|
private |
Definition at line 120 of file InterProcessMutex.h.
|
private |
Definition at line 121 of file InterProcessMutex.h.