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

KDECore

  • sources
  • kde-4.14
  • kdelibs
  • 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 
27 class QString;
28 
36 class KDECORE_EXPORT KLockFile : public KShared
37 {
38 public:
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 
123 private:
124  class Private;
125  Private *const d;
126 };
127 
128 Q_DECLARE_OPERATORS_FOR_FLAGS(KLockFile::LockFlags)
129 
130 #endif
KLockFile::LockError
The lock could not be acquired due to an error.
Definition: klockfile.h:65
KSharedPtr< KLockFile >
ksharedptr.h
kdecore_export.h
KLockFile::LockFlag
LockFlag
Definition: klockfile.h:73
KLockFile::LockResult
LockResult
Possible return values of the lock function.
Definition: klockfile.h:51
pid
static pid_t pid
Definition: k3resolvermanager.cpp:249
KLockFile::LockFail
The lock could not be acquired because it is held by another process.
Definition: klockfile.h:60
KLockFile
The KLockFile class provides NFS safe lockfiles.
Definition: klockfile.h:36
kglobal.h
QSharedData
QString
KLockFile::Ptr
KSharedPtr< KLockFile > Ptr
Definition: klockfile.h:39
KGlobal::mainComponent
const KComponentData & mainComponent()
Returns the global component data.
Definition: kglobal.cpp:145
KComponentData
Per component data.
Definition: kcomponentdata.h:46
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:11 by doxygen 1.8.7 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 API Reference

Skip menu "kdelibs 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

Search



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