KLockFile Class Reference
The KLockFile class provides NFS safe lockfiles. More...
#include <klockfile.h>
Inheritance diagram for KLockFile:


Public Types | |
typedef KSharedPtr< KLockFile > | Ptr |
enum | LockResult { LockOK = 0, LockFail, LockError, LockStale } |
enum | LockOptions { LockNoBlock = 1, LockForce = 2 } |
Public Member Functions | |
KLockFile (const QString &file) | |
~KLockFile () | |
LockResult | lock (int options=0) |
bool | isLocked () const |
void | unlock () |
int | staleTime () const |
void | setStaleTime (int _staleTime) |
bool | getLockInfo (int &pid, QString &hostname, QString &appname) |
Detailed Description
The KLockFile class provides NFS safe lockfiles.
- Author:
- Waldo Bastian <bastian@kde.org>
- Since:
- 3.3
Definition at line 33 of file klockfile.h.
Member Enumeration Documentation
|
Possible return values of the lock function.
Definition at line 48 of file klockfile.h. Referenced by lock(). |
|
Definition at line 70 of file klockfile.h. |
Constructor & Destructor Documentation
|
Destroys the object, releasing the lock if held.
Definition at line 73 of file klockfile.cpp. References unlock(). |
Member Function Documentation
|
Attempt to acquire the lock.
Definition at line 199 of file klockfile.cpp. References lock(), LockError, LockFail, LockForce, LockNoBlock, LockOK, LockResult, LockStale, and KApplication::random(). Referenced by lock(). |
|
Returns whether the lock is held or not.
Definition at line 313 of file klockfile.cpp. |
|
Release the lock.
Definition at line 318 of file klockfile.cpp. Referenced by ~KLockFile(). |
|
Return the time in seconds after which a lock is considered stale The default is 30.
Definition at line 80 of file klockfile.cpp. |
|
Set the time in seconds after which a lock is considered stale.
Definition at line 87 of file klockfile.cpp. References setStaleTime(). Referenced by setStaleTime(). |
|
Returns the pid, hostname and appname of the process holding the lock after the lock functon has returned with LockStale.
Definition at line 327 of file klockfile.cpp. References getLockInfo(). Referenced by getLockInfo(). |
The documentation for this class was generated from the following files: