KDECore
#include <KLockFile>

Public Types | |
enum | LockFlag { NoBlockFlag = 1 , ForceFlag = 2 } |
enum | LockResult { LockOK = 0 , LockFail , LockError , LockStale } |
typedef KSharedPtr< KLockFile > | Ptr |
Public Member Functions | |
KLockFile (const QString &file, const KComponentData &componentName=KGlobal::mainComponent()) | |
~KLockFile () | |
bool | getLockInfo (int &pid, QString &hostname, QString &appname) |
bool | isLocked () const |
LockResult | lock (LockFlags flags=LockFlags()) |
void | setStaleTime (int _staleTime) |
int | staleTime () const |
void | unlock () |
Detailed Description
The KLockFile class provides NFS safe lockfiles.
Definition at line 36 of file klockfile.h.
Member Typedef Documentation
◆ Ptr
typedef KSharedPtr<KLockFile> KLockFile::Ptr |
Definition at line 39 of file klockfile.h.
Member Enumeration Documentation
◆ LockFlag
enum KLockFile::LockFlag |
Definition at line 73 of file klockfile.h.
◆ LockResult
Possible return values of the lock function.
Definition at line 51 of file klockfile.h.
Constructor & Destructor Documentation
◆ KLockFile()
|
explicit |
Definition at line 116 of file klockfile_unix.cpp.
◆ ~KLockFile()
KLockFile::~KLockFile | ( | ) |
Destroys the object, releasing the lock if held.
Definition at line 122 of file klockfile_unix.cpp.
Member Function Documentation
◆ getLockInfo()
Returns the pid, hostname and appname of the process holding the lock after the lock functon has returned with LockStale.
- Returns
- false if the pid and hostname could not be determined
Definition at line 502 of file klockfile_unix.cpp.
◆ isLocked()
bool KLockFile::isLocked | ( | ) | const |
Returns whether the lock is held or not.
Definition at line 482 of file klockfile_unix.cpp.
◆ lock()
KLockFile::LockResult KLockFile::lock | ( | LockFlags | flags = LockFlags() | ) |
Attempt to acquire the lock.
- Parameters
-
flags A set of LockFlag values OR'ed together.
Definition at line 386 of file klockfile_unix.cpp.
◆ setStaleTime()
void KLockFile::setStaleTime | ( | int | _staleTime | ) |
Set the time in seconds after which a lock is considered stale.
Definition at line 136 of file klockfile_unix.cpp.
◆ staleTime()
int KLockFile::staleTime | ( | ) | const |
Return the time in seconds after which a lock is considered stale The default is 30.
Definition at line 129 of file klockfile_unix.cpp.
◆ unlock()
void KLockFile::unlock | ( | ) |
Release the lock.
Definition at line 487 of file klockfile_unix.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.