libzypp 17.31.23
zypp::ZYppGlobalLock Class Reference

Our broken global lock. More...

Public Member Functions

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

Private Types

typedef shared_ptr< void > ScopedGuard
 

Private Member Functions

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

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 104 of file ZYppFactory.cc.

Member Typedef Documentation

◆ ScopedGuard

Definition at line 153 of file ZYppFactory.cc.

Constructor & Destructor Documentation

◆ ZYppGlobalLock()

zypp::ZYppGlobalLock::ZYppGlobalLock ( Pathname &&  lFilePath)
inline

Definition at line 107 of file ZYppFactory.cc.

◆ ~ZYppGlobalLock()

zypp::ZYppGlobalLock::~ZYppGlobalLock ( )
inline

Definition at line 116 of file ZYppFactory.cc.

Member Function Documentation

◆ lockerPid()

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

Definition at line 133 of file ZYppFactory.cc.

◆ lockerName()

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

Definition at line 136 of file ZYppFactory.cc.

◆ zyppLockFilePath()

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

Definition at line 139 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() );
shared_ptr< void > ScopedGuard
Definition: ZYppFactory.cc:153
ScopedGuard accessLockFile()
Exception safe access to the lockfile.
Definition: ZYppFactory.cc:161

Definition at line 161 of file ZYppFactory.cc.

◆ _openLockFile()

void zypp::ZYppGlobalLock::_openLockFile ( )
inlineprivate

Use accessLockFile.

Definition at line 169 of file ZYppFactory.cc.

◆ _closeLockFile()

void zypp::ZYppGlobalLock::_closeLockFile ( )
inlineprivate

Use accessLockFile.

Definition at line 183 of file ZYppFactory.cc.

◆ isProcessRunning()

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

Definition at line 201 of file ZYppFactory.cc.

◆ readLockFile()

pid_t zypp::ZYppGlobalLock::readLockFile ( )
inlineprivate

Definition at line 228 of file ZYppFactory.cc.

◆ writeLockFile()

void zypp::ZYppGlobalLock::writeLockFile ( )
inlineprivate

Definition at line 238 of file ZYppFactory.cc.

◆ safeCheckIsLocked()

bool zypp::ZYppGlobalLock::safeCheckIsLocked ( )
inlineprivate

Expects the calling function to lock the access lock

Definition at line 252 of file ZYppFactory.cc.

◆ isZyppLocked()

bool zypp::ZYppGlobalLock::isZyppLocked ( )
inline

Definition at line 275 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 289 of file ZYppFactory.cc.

Member Data Documentation

◆ _zyppLockFilePath

Pathname zypp::ZYppGlobalLock::_zyppLockFilePath
private

Definition at line 144 of file ZYppFactory.cc.

◆ _zyppLockFileLock

file_lock zypp::ZYppGlobalLock::_zyppLockFileLock
private

Definition at line 145 of file ZYppFactory.cc.

◆ _zyppLockFile

FILE* zypp::ZYppGlobalLock::_zyppLockFile
private

Definition at line 146 of file ZYppFactory.cc.

◆ _lockerPid

pid_t zypp::ZYppGlobalLock::_lockerPid
private

Definition at line 148 of file ZYppFactory.cc.

◆ _lockerName

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

Definition at line 149 of file ZYppFactory.cc.

◆ _cleanLock

bool zypp::ZYppGlobalLock::_cleanLock
private

Definition at line 150 of file ZYppFactory.cc.


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