klockfile.h
/*
This file is part of the KDE libraries
Copyright (c) 2004 Waldo Bastian <bastian@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _KLOCKFILE_H_
#define _KLOCKFILE_H_
#include <qstring.h>
#include <qdatetime.h>
#include <ksharedptr.h>
class KDECORE_EXPORT KLockFile : public KShared
{
public:
typedef KSharedPtr<KLockFile> Ptr;
KLockFile(const QString &file);
~KLockFile();
enum LockResult {
LockOK = 0,
LockFail,
LockError,
LockStale
};
enum LockOptions {
LockNoBlock = 1,
LockForce = 2
};
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);
private:
class KLockFilePrivate;
KLockFilePrivate *d;
};
#endif
KLockFile::LockError
The lock could not be acquired due to an error.
Definition: klockfile.h:62
KSharedPtr< KLockFile >
KLockFile::LockResult
LockResult
Possible return values of the lock function.
Definition: klockfile.h:48
KLockFile::LockFail
The lock could not be acquired because it is held by another process.
Definition: klockfile.h:57
KLockFile
The KLockFile class provides NFS safe lockfiles.
Definition: klockfile.h:33
KLockFile::LockOptions
LockOptions
Definition: klockfile.h:70
KShared
Reference counting for shared objects.
Definition: ksharedptr.h:40

KDE Home | KDE Accessibility Home | Description of Access Keys