libzypp: zypp::ZYppGlobalLock Class Reference

libzypp 17.38.14

zypp::ZYppGlobalLock Class Reference

Our broken global lock. More...

## Public Member Functions
| ZYppGlobalLock (Pathname &&lFilePath)
| ZYppGlobalLock (const ZYppGlobalLock &)=delete
| ZYppGlobalLock (ZYppGlobalLock &&)=delete
ZYppGlobalLock & | operator= (const ZYppGlobalLock &)=delete
ZYppGlobalLock & | operator= (ZYppGlobalLock &&)=delete
| ~ZYppGlobalLock ()
pid_t | lockerPid () const
const std::string & | lockerName () const
const Pathname & | zyppLockFilePath () const
bool | isZyppLocked ()
bool | zyppLocked ()
| Try to aquire a lock.

## Private Types
using | ScopedGuard = shared_ptr<void>

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

## Member Typedef Documentation

## ◆ ScopedGuard

using zypp::ZYppGlobalLock::ScopedGuard = shared_ptr<void>
| private

Definition at line 157 of file ZYppFactory.cc.

## Constructor & Destructor Documentation

## ◆ ZYppGlobalLock() [1/3]

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

Definition at line 109 of file ZYppFactory.cc.

## ◆ ZYppGlobalLock() [2/3]

zypp::ZYppGlobalLock::ZYppGlobalLock | ( | const ZYppGlobalLock & |  | ) |
| delete

## ◆ ZYppGlobalLock() [3/3]

zypp::ZYppGlobalLock::ZYppGlobalLock | ( | ZYppGlobalLock && |  | ) |
| delete

## ◆ ~ZYppGlobalLock()

zypp::ZYppGlobalLock::~ZYppGlobalLock | ( |  | ) |
| inline

Definition at line 120 of file ZYppFactory.cc.

## Member Function Documentation

## ◆ operator=() [1/2]

ZYppGlobalLock & zypp::ZYppGlobalLock::operator= | ( | const ZYppGlobalLock & |  | ) |
| delete

## ◆ operator=() [2/2]

ZYppGlobalLock & zypp::ZYppGlobalLock::operator= | ( | ZYppGlobalLock && |  | ) |
| delete

## ◆ lockerPid()

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

Definition at line 137 of file ZYppFactory.cc.

## ◆ lockerName()

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

Definition at line 140 of file ZYppFactory.cc.

## ◆ zyppLockFilePath()

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

Definition at line 143 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() );
zypp::ZYppGlobalLock::ScopedGuard
shared_ptr< void > ScopedGuard
Definition ZYppFactory.cc:157
zypp::ZYppGlobalLock::accessLockFile
ScopedGuard accessLockFile()
Exception safe access to the lockfile.
Definition ZYppFactory.cc:165

Definition at line 165 of file ZYppFactory.cc.

## ◆ _openLockFile()

void zypp::ZYppGlobalLock::_openLockFile | ( |  | ) |
| inlineprivate

Use accessLockFile.

Definition at line 173 of file ZYppFactory.cc.

## ◆ _closeLockFile()

void zypp::ZYppGlobalLock::_closeLockFile | ( |  | ) |
| inlineprivate

Use accessLockFile.

Definition at line 187 of file ZYppFactory.cc.

## ◆ isProcessRunning()

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

Definition at line 205 of file ZYppFactory.cc.

## ◆ readLockFile()

pid_t zypp::ZYppGlobalLock::readLockFile | ( |  | ) |
| inlineprivate

Definition at line 232 of file ZYppFactory.cc.

## ◆ writeLockFile()

void zypp::ZYppGlobalLock::writeLockFile | ( |  | ) |
| inlineprivate

Definition at line 242 of file ZYppFactory.cc.

## ◆ safeCheckIsLocked()

bool zypp::ZYppGlobalLock::safeCheckIsLocked | ( |  | ) |
| inlineprivate

Expects the calling function to lock the access lock

Definition at line 256 of file ZYppFactory.cc.

## ◆ isZyppLocked()

bool zypp::ZYppGlobalLock::isZyppLocked | ( |  | ) |
| inline

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

## Member Data Documentation

## ◆ _zyppLockFilePath

Pathname zypp::ZYppGlobalLock::_zyppLockFilePath
| private

Definition at line 148 of file ZYppFactory.cc.

## ◆ _zyppLockFileLock

file_lock zypp::ZYppGlobalLock::_zyppLockFileLock
| private

Definition at line 149 of file ZYppFactory.cc.

## ◆ _zyppLockFile

FILE* zypp::ZYppGlobalLock::_zyppLockFile
| private

Definition at line 150 of file ZYppFactory.cc.

## ◆ _lockerPid

pid_t zypp::ZYppGlobalLock::_lockerPid
| private

Definition at line 152 of file ZYppFactory.cc.

## ◆ _lockerName

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

Definition at line 153 of file ZYppFactory.cc.

## ◆ _cleanLock

bool zypp::ZYppGlobalLock::_cleanLock
| private

Definition at line 154 of file ZYppFactory.cc.

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

- zypp/ZYppFactory.cc