Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qlockfile_p.h
Go to the documentation of this file.
1// Copyright (C) 2013 David Faure <faure+bluesystems@kde.org>
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QLOCKFILE_P_H
6#define QLOCKFILE_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtCore/private/qglobal_p.h>
20#include <QtCore/qlockfile.h>
21#include <QtCore/qfile.h>
22
24
26{
27public:
36
37 explicit QLockFilePrivate(const QString &fn);
39
41 bool removeStaleLock();
43 // Returns \c true if the lock belongs to dead PID, or is old.
44 // The attempt to delete it will tell us if it was really stale or not, though.
45 bool isApparentlyStale() const;
46
47 // used in dbusmenu
48 Q_CORE_EXPORT static QString processNameByPid(qint64 pid);
49 static bool isProcessRunning(qint64 pid, const QString &appname);
50
52
53 static bool getLockInfo_helper(const QString &fileName, LockFileInfo *info);
54 static int openNewFileDescriptor(const QString &fileName);
55
56#ifdef Q_OS_WIN
58#else
60#endif
61
62 std::chrono::milliseconds staleLockTime = std::chrono::seconds{30};
64 bool isLocked = false;
65
66 // used in tst_QLockFile:
67 static auto getLockFileHandle(QLockFile *f)
68 {
69 return f->d_func()->fileHandle;
70 }
71};
72
73QT_END_NAMESPACE
74
75#endif /* QLOCKFILE_P_H */
static auto getLockFileHandle(QLockFile *f)
Definition qlockfile_p.h:67
static bool getLockInfo_helper(const QString &fileName, LockFileInfo *info)
static int openNewFileDescriptor(const QString &fileName)
QLockFilePrivate(const QString &fn)
bool isApparentlyStale() const
static bool isProcessRunning(qint64 pid, const QString &appname)
std::chrono::milliseconds staleLockTime
Definition qlockfile_p.h:62
QByteArray lockFileContents() const
\inmodule QtCore
Definition qlockfile.h:19
Combined button and popup list for selecting options.
static QString machineName()
Definition qlockfile.cpp:27