.TH "KLockFile" kde3 "11 Jun 2005" "Version Version 3.4.1" "kdecore Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KLockFile \- The KLockFile class provides NFS safe lockfiles.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <klockfile.h>\fP
.PP
Inherits \fBKShared\fP.
.PP
.SS "Public Types"

.in +1c
.ti -1c
.RI "typedef \fBKSharedPtr\fP< \fBKLockFile\fP > \fBPtr\fP"
.br
.ti -1c
.RI "enum \fBLockResult\fP { \fBLockOK\fP =  0, \fBLockFail\fP, \fBLockError\fP, \fBLockStale\fP }"
.br
.ti -1c
.RI "enum \fBLockOptions\fP { \fBLockNoBlock\fP =  1, \fBLockForce\fP =  2 }"
.br
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKLockFile\fP (const \fBQString\fP &file)"
.br
.ti -1c
.RI "\fB~KLockFile\fP ()"
.br
.ti -1c
.RI "\fBLockResult\fP \fBlock\fP (int options=0)"
.br
.ti -1c
.RI "bool \fBisLocked\fP () const "
.br
.ti -1c
.RI "void \fBunlock\fP ()"
.br
.ti -1c
.RI "int \fBstaleTime\fP () const "
.br
.ti -1c
.RI "void \fBsetStaleTime\fP (int _staleTime)"
.br
.ti -1c
.RI "bool \fBgetLockInfo\fP (int &pid, \fBQString\fP &hostname, \fBQString\fP &appname)"
.br
.in -1c
.SH "Detailed Description"
.PP 
The KLockFile class provides NFS safe lockfiles. 

\fBAuthor:\fP
.RS 4
Waldo Bastian <bastian@kde.org> 
.RE
.PP
\fBSince:\fP
.RS 4
3.3 
.RE
.PP

.PP
Definition at line 33 of file klockfile.h.
.SH "Member Enumeration Documentation"
.PP 
.SS "enum \fBKLockFile::LockResult\fP"
.PP
Possible return values of the lock function. 
.PP
\fBEnumeration values: \fP
.in +1c
.TP
\fB\fILockOK \fP\fP
Lock was acquired successfully. 
.TP
\fB\fILockFail \fP\fP
The lock could not be acquired because it is held by another process. 
.TP
\fB\fILockError \fP\fP
The lock could not be acquired due to an error. 
.TP
\fB\fILockStale \fP\fP
A stale lock has been detected. 
.PP
Definition at line 48 of file klockfile.h.
.SS "enum \fBKLockFile::LockOptions\fP"
.PP
\fBEnumeration values: \fP
.in +1c
.TP
\fB\fILockNoBlock \fP\fP
Return immediately, do not wait for the lock to become available. 
.TP
\fB\fILockForce \fP\fP
Automatically remove a lock when a lock is detected that is stale for more than \fBstaleTime()\fP seconds. 
.PP
Definition at line 70 of file klockfile.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KLockFile::~\fBKLockFile\fP ()"
.PP
Destroys the object, releasing the lock if held. 
.PP
Definition at line 73 of file klockfile.cpp.
.PP
References unlock().
.SH "Member Function Documentation"
.PP 
.SS "\fBKLockFile::LockResult\fP KLockFile::lock (int options = \fC0\fP)"
.PP
Attempt to acquire the lock. 
.PP
\fBParameters:\fP
.RS 4
\fIoptions\fP A set of \fBLockOptions\fP OR'ed together. 
.RE
.PP

.PP
Definition at line 199 of file klockfile.cpp.
.PP
References QTextStream::atEnd(), LockError, LockFail, LockForce, LockNoBlock, LockOK, LockStale, KApplication::random(), and QTextStream::readLine().
.SS "bool KLockFile::isLocked () const"
.PP
Returns whether the lock is held or not. 
.PP
Definition at line 313 of file klockfile.cpp.
.SS "void KLockFile::unlock ()"
.PP
Release the lock. 
.PP
Definition at line 318 of file klockfile.cpp.
.PP
References QFile::encodeName().
.PP
Referenced by ~KLockFile().
.SS "int KLockFile::staleTime () const"
.PP
Return the time in seconds after which a lock is considered stale The default is 30. 
.PP
Definition at line 80 of file klockfile.cpp.
.SS "void KLockFile::setStaleTime (int _staleTime)"
.PP
Set the time in seconds after which a lock is considered stale. 
.PP
Definition at line 87 of file klockfile.cpp.
.SS "bool KLockFile::getLockInfo (int & pid, \fBQString\fP & hostname, \fBQString\fP & appname)"
.PP
Returns the pid, hostname and appname of the process holding the lock after the lock functon has returned with LockStale. 
.PP
\fBReturns:\fP
.RS 4
false if the pid and hostname could not be determined 
.RE
.PP

.PP
Definition at line 327 of file klockfile.cpp.

.SH "Author"
.PP 
Generated automatically by Doxygen for kdecore Library from the source code.
