libzypp  17.5.0
zypp::ZYppGlobalLock Class Reference

Our broken global lock. More...

Public Member Functions

 ZYppGlobalLock ()
 
 ~ZYppGlobalLock ()
 
pid_t lockerPid () const
 
const std::string & lockerName () const
 
const PathnamezyppLockFilePath () const
 
bool zyppLocked ()
 Try to aquire a lock. More...
 

Private Types

typedef shared_ptr< void > ScopedGuard
 

Private Member Functions

ScopedGuard accessLockFile ()
 Exception safe access to the lockfile. More...
 
void _openLockFile ()
 Use accessLockFile. More...
 
void _closeLockFile ()
 Use accessLockFile. More...
 
bool isProcessRunning (pid_t pid_r)
 
pid_t readLockFile ()
 
void writeLockFile ()
 

Private Attributes

Pathname _zyppLockFilePath
 
file_lock _zyppLockFileLock
 
FILE * _zyppLockFile
 
pid_t _lockerPid
 
std::string _lockerName
 
bool _cleanLock
 

Detailed Description

Our broken global lock.

Definition at line 93 of file ZYppFactory.cc.

Member Typedef Documentation

◆ ScopedGuard

Definition at line 142 of file ZYppFactory.cc.

Constructor & Destructor Documentation

◆ ZYppGlobalLock()

zypp::ZYppGlobalLock::ZYppGlobalLock ( )
inline

Definition at line 96 of file ZYppFactory.cc.

◆ ~ZYppGlobalLock()

zypp::ZYppGlobalLock::~ZYppGlobalLock ( )
inline

Definition at line 105 of file ZYppFactory.cc.

Member Function Documentation

◆ lockerPid()

pid_t zypp::ZYppGlobalLock::lockerPid ( ) const
inline

Definition at line 122 of file ZYppFactory.cc.

◆ lockerName()

const std::string& zypp::ZYppGlobalLock::lockerName ( ) const
inline

Definition at line 125 of file ZYppFactory.cc.

◆ zyppLockFilePath()

const Pathname& zypp::ZYppGlobalLock::zyppLockFilePath ( ) const
inline

Definition at line 128 of file ZYppFactory.cc.

◆ accessLockFile()

ScopedGuard zypp::ZYppGlobalLock::accessLockFile ( )
inlineprivate

Exception safe access to the lockfile.

// Exception safe access to the lockfile.
ScopedGuard closeOnReturn( accessLockFile() );

Definition at line 150 of file ZYppFactory.cc.

◆ _openLockFile()

void zypp::ZYppGlobalLock::_openLockFile ( )
inlineprivate

Use accessLockFile.

Definition at line 158 of file ZYppFactory.cc.

◆ _closeLockFile()

void zypp::ZYppGlobalLock::_closeLockFile ( )
inlineprivate

Use accessLockFile.

Definition at line 172 of file ZYppFactory.cc.

◆ isProcessRunning()

bool zypp::ZYppGlobalLock::isProcessRunning ( pid_t  pid_r)
inlineprivate

Definition at line 190 of file ZYppFactory.cc.

◆ readLockFile()

pid_t zypp::ZYppGlobalLock::readLockFile ( )
inlineprivate

Definition at line 217 of file ZYppFactory.cc.

◆ writeLockFile()

void zypp::ZYppGlobalLock::writeLockFile ( )
inlineprivate

Definition at line 227 of file ZYppFactory.cc.

◆ zyppLocked()

bool zypp::ZYppGlobalLock::zyppLocked ( )
inline

Try to aquire a lock.

Returns
true if zypp is already locked by another process.

Definition at line 243 of file ZYppFactory.cc.

Member Data Documentation

◆ _zyppLockFilePath

Pathname zypp::ZYppGlobalLock::_zyppLockFilePath
private

Definition at line 133 of file ZYppFactory.cc.

◆ _zyppLockFileLock

file_lock zypp::ZYppGlobalLock::_zyppLockFileLock
private

Definition at line 134 of file ZYppFactory.cc.

◆ _zyppLockFile

FILE* zypp::ZYppGlobalLock::_zyppLockFile
private

Definition at line 135 of file ZYppFactory.cc.

◆ _lockerPid

pid_t zypp::ZYppGlobalLock::_lockerPid
private

Definition at line 137 of file ZYppFactory.cc.

◆ _lockerName

std::string zypp::ZYppGlobalLock::_lockerName
private

Definition at line 138 of file ZYppFactory.cc.

◆ _cleanLock

bool zypp::ZYppGlobalLock::_cleanLock
private

Definition at line 139 of file ZYppFactory.cc.


The documentation for this class was generated from the following file: