• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • kdecore
  • io
klockfile.h
Go to the documentation of this file.
1/*
2 This file is part of the KDE libraries
3 Copyright (c) 2004 Waldo Bastian <bastian@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License version 2 as published by the Free Software Foundation.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#ifndef KLOCKFILE_H
21#define KLOCKFILE_H
22
23#include <kdecore_export.h>
24#include <ksharedptr.h>
25#include <kglobal.h>
26
27class QString;
28
36class KDECORE_EXPORT KLockFile : public KShared
37{
38public:
39 typedef KSharedPtr<KLockFile> Ptr;
40
41 explicit KLockFile(const QString &file, const KComponentData &componentName = KGlobal::mainComponent());
42
46 ~KLockFile();
47
51 enum LockResult {
55 LockOK = 0,
56
60 LockFail,
61
65 LockError,
66
70 LockStale
71 };
72
73 enum LockFlag {
77 NoBlockFlag = 1,
78
84 ForceFlag = 2
85 };
86 Q_DECLARE_FLAGS(LockFlags, LockFlag)
87
88
93 LockResult lock(LockFlags flags=LockFlags());
94
98 bool isLocked() const;
99
103 void unlock();
104
109 int staleTime() const;
110
114 void setStaleTime(int _staleTime);
115
121 bool getLockInfo(int &pid, QString &hostname, QString &appname);
122
123private:
124 class Private;
125 Private *const d;
126};
127
128Q_DECLARE_OPERATORS_FOR_FLAGS(KLockFile::LockFlags)
129
130#endif
KComponentData
Per component data.
Definition: kcomponentdata.h:47
KLockFile
The KLockFile class provides NFS safe lockfiles.
Definition: klockfile.h:37
KLockFile::LockResult
LockResult
Possible return values of the lock function.
Definition: klockfile.h:51
KLockFile::LockFail
@ LockFail
The lock could not be acquired because it is held by another process.
Definition: klockfile.h:60
KLockFile::LockError
@ LockError
The lock could not be acquired due to an error.
Definition: klockfile.h:65
KLockFile::Ptr
KSharedPtr< KLockFile > Ptr
Definition: klockfile.h:39
KLockFile::LockFlag
LockFlag
Definition: klockfile.h:73
KSharedPtr
Can be used to control the lifetime of an object that has derived QSharedData.
Definition: ksharedptr.h:64
KShared
QString
pid
static pid_t pid
Definition: k3resolvermanager.cpp:249
kdecore_export.h
kglobal.h
ksharedptr.h
KGlobal::mainComponent
const KComponentData & mainComponent()
Returns the global component data.
Definition: kglobal.cpp:145
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal