Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QLockFilePrivate Class Reference

#include <qlockfile_p.h>

+ Collaboration diagram for QLockFilePrivate:

Public Member Functions

 QLockFilePrivate (const QString &fn)
 
QLockFile::LockError tryLock_sys ()
 
bool removeStaleLock ()
 
QByteArray lockFileContents () const
 
bool isApparentlyStale () const
 

Static Public Member Functions

static Q_CORE_EXPORT QString processNameByPid (qint64 pid)
 
static bool isProcessRunning (qint64 pid, const QString &appname)
 
static int getLockFileHandle (QLockFile *f)
 

Public Attributes

QString fileName
 
int fileHandle = -1
 
std::chrono::milliseconds staleLockTime = std::chrono::seconds{30}
 
QLockFile::LockError lockError = QLockFile::NoError
 
bool isLocked = false
 

Detailed Description

Definition at line 31 of file qlockfile_p.h.

Constructor & Destructor Documentation

◆ QLockFilePrivate()

QLockFilePrivate::QLockFilePrivate ( const QString & fn)
inline

Definition at line 34 of file qlockfile_p.h.

Member Function Documentation

◆ getLockFileHandle()

static int QLockFilePrivate::getLockFileHandle ( QLockFile * f)
inlinestatic

Definition at line 61 of file qlockfile_p.h.

◆ isApparentlyStale()

bool QLockFilePrivate::isApparentlyStale ( ) const

Definition at line 416 of file qlockfile.cpp.

References QSysInfo::bootUniqueId(), QDateTime::currentDateTimeUtc(), fileName, getLockInfo_helper(), info, isProcessRunning(), QFileInfo::lastModified(), machineName(), QSysInfo::machineUniqueId(), QDateTime::msecsTo(), staleLockTime, and QTimeZone::UTC.

+ Here is the call graph for this function:

◆ isProcessRunning()

bool QLockFilePrivate::isProcessRunning ( qint64 pid,
const QString & appname )
static

Definition at line 171 of file qlockfile_unix.cpp.

References processNameByPid().

Referenced by isApparentlyStale().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lockFileContents()

QByteArray QLockFilePrivate::lockFileContents ( ) const

Definition at line 376 of file qlockfile.cpp.

References QCoreApplication::applicationPid(), QSysInfo::bootUniqueId(), machineName(), QSysInfo::machineUniqueId(), QByteArray::number(), and processNameByPid().

Referenced by tryLock_sys().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processNameByPid()

QString QLockFilePrivate::processNameByPid ( qint64 pid)
static

Definition at line 188 of file qlockfile_unix.cpp.

References QFile::decodeName(), QFileSystemEntry::fileName(), info, PATH_MAX, Q_UNUSED, QStringLiteral, qt_haveLinuxProcfs(), qt_readlink(), qt_safe_close(), qt_safe_open(), qt_safe_read(), and Qt::Uninitialized.

Referenced by isProcessRunning(), and lockFileContents().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeStaleLock()

bool QLockFilePrivate::removeStaleLock ( )

Definition at line 160 of file qlockfile_unix.cpp.

References QFile::encodeName(), fileName, lockFileName(), qt_safe_open(), and setNativeLocks().

+ Here is the call graph for this function:

◆ tryLock_sys()

QLockFile::LockError QLockFilePrivate::tryLock_sys ( )

Member Data Documentation

◆ fileHandle

int QLockFilePrivate::fileHandle = -1

Definition at line 54 of file qlockfile_p.h.

Referenced by tryLock_sys().

◆ fileName

QString QLockFilePrivate::fileName

Definition at line 49 of file qlockfile_p.h.

Referenced by QLockFile::fileName(), isApparentlyStale(), removeStaleLock(), and tryLock_sys().

◆ isLocked

bool QLockFilePrivate::isLocked = false

Definition at line 59 of file qlockfile_p.h.

◆ lockError

QLockFile::LockError QLockFilePrivate::lockError = QLockFile::NoError

Definition at line 58 of file qlockfile_p.h.

◆ staleLockTime

std::chrono::milliseconds QLockFilePrivate::staleLockTime = std::chrono::seconds{30}

Definition at line 57 of file qlockfile_p.h.

Referenced by isApparentlyStale().


The documentation for this class was generated from the following files: