KLockFile Class Reference
#include <klockfile.h>
Inheritance diagram for KLockFile:

Detailed Description
The KLockFile class provides NFS safe lockfiles.
- Since:
- 3.3
Definition at line 33 of file klockfile.h.
Public Types | |
enum | LockResult { LockOK = 0, LockFail, LockError, LockStale } |
enum | LockOptions { LockNoBlock = 1, LockForce = 2 } |
typedef KSharedPtr< KLockFile > | Ptr |
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) |
Member Enumeration Documentation
Possible return values of the lock function.
- Enumerator:
Definition at line 48 of file klockfile.h.
- Enumerator:
-
LockNoBlock Return immediately, do not wait for the lock to become available. LockForce Automatically remove a lock when a lock is detected that is stale for more than staleTime() seconds.
Definition at line 70 of file klockfile.h.
Constructor & Destructor Documentation
KLockFile::~KLockFile | ( | ) |
Member Function Documentation
KLockFile::LockResult KLockFile::lock | ( | int | options = 0 |
) |
Attempt to acquire the lock.
- Parameters:
-
options A set of LockOptions OR'ed together.
Definition at line 240 of file klockfile.cpp.
bool KLockFile::isLocked | ( | ) | const |
void KLockFile::unlock | ( | ) |
int KLockFile::staleTime | ( | ) | const |
Return the time in seconds after which a lock is considered stale The default is 30.
Definition at line 82 of file klockfile.cpp.
void KLockFile::setStaleTime | ( | int | _staleTime | ) |
Set the time in seconds after which a lock is considered stale.
Definition at line 89 of file klockfile.cpp.
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 368 of file klockfile.cpp.
The documentation for this class was generated from the following files: