zypp::ZYppGlobalLock Class Reference

Our broken global lock. More...

List of all members.

Public Member Functions

 ZYppGlobalLock ()
 ~ZYppGlobalLock ()
pid_t lockerPid () const
const std::string & lockerName () const
const Pathname & zyppLockFilePath () const
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 ()

Private Attributes

Pathname _zyppLockFilePath
scoped_ptr< file_lock > _zyppLockFileLockPtr
FILE * _zyppLockFile
pid_t _lockerPid
std::string _lockerName
bool _cleanLock


Detailed Description

Our broken global lock.

Definition at line 76 of file ZYppFactory.cc.


Member Typedef Documentation

typedef shared_ptr<void> zypp::ZYppGlobalLock::ScopedGuard [private]

Definition at line 125 of file ZYppFactory.cc.


Constructor & Destructor Documentation

zypp::ZYppGlobalLock::ZYppGlobalLock (  )  [inline]

Definition at line 79 of file ZYppFactory.cc.

References _zyppLockFilePath, and zypp::filesystem::assert_dir().

zypp::ZYppGlobalLock::~ZYppGlobalLock (  )  [inline]

Definition at line 88 of file ZYppFactory.cc.

References _cleanLock, _zyppLockFile, _zyppLockFileLockPtr, accessLockFile(), and MIL.


Member Function Documentation

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

Definition at line 105 of file ZYppFactory.cc.

References _lockerPid.

Referenced by zypp::ZYppFactory::getZYpp().

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

Definition at line 108 of file ZYppFactory.cc.

References _lockerName.

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

Definition at line 111 of file ZYppFactory.cc.

References _zyppLockFilePath.

Referenced by zypp::ZYppFactory::getZYpp().

ScopedGuard zypp::ZYppGlobalLock::accessLockFile (  )  [inline, private]

Exception safe access to the lockfile.

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

Definition at line 133 of file ZYppFactory.cc.

References _closeLockFile(), and _openLockFile().

Referenced by zyppLocked(), and ~ZYppGlobalLock().

void zypp::ZYppGlobalLock::_openLockFile (  )  [inline, private]

Use accessLockFile.

Definition at line 141 of file ZYppFactory.cc.

References _zyppLockFile, _zyppLockFileLockPtr, _zyppLockFilePath, MIL, and ZYPP_THROW.

Referenced by accessLockFile().

void zypp::ZYppGlobalLock::_closeLockFile (  )  [inline, private]

Use accessLockFile.

Definition at line 155 of file ZYppFactory.cc.

References _zyppLockFile, _zyppLockFileLockPtr, _zyppLockFilePath, and MIL.

Referenced by accessLockFile().

bool zypp::ZYppGlobalLock::isProcessRunning ( pid_t  pid_r  )  [inline, private]

Definition at line 173 of file ZYppFactory.cc.

References _lockerName, DBG, MIL, and zypp::str::numstring().

Referenced by zyppLocked().

pid_t zypp::ZYppGlobalLock::readLockFile (  )  [inline, private]

Definition at line 200 of file ZYppFactory.cc.

References _zyppLockFile, _zyppLockFilePath, and MIL.

Referenced by zyppLocked().

void zypp::ZYppGlobalLock::writeLockFile (  )  [inline, private]

Definition at line 210 of file ZYppFactory.cc.

References _cleanLock, _zyppLockFile, _zyppLockFilePath, and MIL.

Referenced by zyppLocked().

bool zypp::ZYppGlobalLock::zyppLocked (  )  [inline]

Try to aquire a lock.

Returns:
true if zypp is already locked by another process.

Definition at line 226 of file ZYppFactory.cc.

References _lockerPid, _zyppLockFileLockPtr, accessLockFile(), INT, isProcessRunning(), MIL, readLockFile(), WAR, and writeLockFile().

Referenced by zypp::ZYppFactory::getZYpp().


Member Data Documentation

scoped_ptr<file_lock> zypp::ZYppGlobalLock::_zyppLockFileLockPtr [private]

Definition at line 117 of file ZYppFactory.cc.

Referenced by _closeLockFile(), _openLockFile(), zyppLocked(), and ~ZYppGlobalLock().

Definition at line 120 of file ZYppFactory.cc.

Referenced by lockerPid(), and zyppLocked().

std::string zypp::ZYppGlobalLock::_lockerName [private]

Definition at line 121 of file ZYppFactory.cc.

Referenced by isProcessRunning(), and lockerName().

Definition at line 122 of file ZYppFactory.cc.

Referenced by writeLockFile(), and ~ZYppGlobalLock().


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

Generated on Tue May 5 14:49:29 2015 for libzypp by  doxygen 1.5.6