KDECore
KLockFile Class Reference
The KLockFile class provides NFS safe lockfiles. More...
#include <KLockFile>

Public Types | |
| enum | LockFlag { NoBlockFlag = 1, ForceFlag = 2 } |
| enum | LockResult { LockOK = 0, LockFail, LockError, LockStale } |
| typedef KSharedPtr< KLockFile > | Ptr |
Public Member Functions | |
| bool | getLockInfo (int &pid, QString &hostname, QString &appname) |
| bool | isLocked () const |
| KLockFile (const QString &file, const KComponentData &componentName=KGlobal::mainComponent()) | |
| LockResult | lock (LockFlags flags=LockFlags()) |
| void | setStaleTime (int _staleTime) |
| int | staleTime () const |
| void | unlock () |
| ~KLockFile () | |
Detailed Description
The KLockFile class provides NFS safe lockfiles.
Definition at line 36 of file klockfile.h.
Member Typedef Documentation
| typedef KSharedPtr<KLockFile> KLockFile::Ptr |
Definition at line 39 of file klockfile.h.
Member Enumeration Documentation
| enum KLockFile::LockFlag |
- Enumerator:
-
NoBlockFlag Return immediately, do not wait for the lock to become available. ForceFlag Automatically remove a lock when a lock is detected that is stale for more than staleTime() seconds.
Definition at line 73 of file klockfile.h.
Possible return values of the lock function.
- Enumerator:
Definition at line 51 of file klockfile.h.
Constructor & Destructor Documentation
| KLockFile::KLockFile | ( | const QString & | file, | |
| const KComponentData & | componentName = KGlobal::mainComponent() | |||
| ) | [explicit] |
Definition at line 72 of file klockfile_unix.cpp.
| KLockFile::~KLockFile | ( | ) |
Member Function Documentation
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 372 of file klockfile_unix.cpp.
| bool KLockFile::isLocked | ( | ) | const |
| 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 248 of file klockfile_unix.cpp.
| void KLockFile::setStaleTime | ( | int | _staleTime | ) |
Set the time in seconds after which a lock is considered stale.
Definition at line 96 of file klockfile_unix.cpp.
| int KLockFile::staleTime | ( | ) | const |
Return the time in seconds after which a lock is considered stale The default is 30.
Definition at line 89 of file klockfile_unix.cpp.
| void KLockFile::unlock | ( | ) |
The documentation for this class was generated from the following files:
KDE 4.2 API Reference