diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-20 09:30:00 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-20 21:09:00 +0200 |
commit | b6cd3bca280bd81e932ff51a3ec2b9fc70231646 (patch) | |
tree | f77332d26736b7b112dfc0737555d08ffac40975 /src/corelib/io/qlockfile_win.cpp | |
parent | 80a2878e201f294697d69b7606571a036c36a19d (diff) |
Whitespace cleanup in corelib/iov6.0.0-beta2
Selective application of clang-format to follow our coding style where
it is significantly off.
Change-Id: I0ff4ed146fe53922691d5473d0c236f31d478a04
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/corelib/io/qlockfile_win.cpp')
-rw-r--r-- | src/corelib/io/qlockfile_win.cpp | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/corelib/io/qlockfile_win.cpp b/src/corelib/io/qlockfile_win.cpp index 77cdf66694..46a6b9da5e 100644 --- a/src/corelib/io/qlockfile_win.cpp +++ b/src/corelib/io/qlockfile_win.cpp @@ -167,21 +167,24 @@ QString QLockFilePrivate::processNameByPid(qint64 pid) void QLockFile::unlock() { Q_D(QLockFile); - if (!d->isLocked) + if (!d->isLocked) return; - CloseHandle(d->fileHandle); - int attempts = 0; - static const int maxAttempts = 500; // 500ms - while (!QFile::remove(d->fileName) && ++attempts < maxAttempts) { - // Someone is reading the lock file right now (on Windows this prevents deleting it). - QThread::msleep(1); - } - if (attempts == maxAttempts) { - qWarning() << "Could not remove our own lock file" << d->fileName << ". Either other users of the lock file are reading it constantly for 500 ms, or we (no longer) have permissions to delete the file"; - // This is bad because other users of this lock file will now have to wait for the stale-lock-timeout... - } - d->lockError = QLockFile::NoError; - d->isLocked = false; + CloseHandle(d->fileHandle); + int attempts = 0; + static const int maxAttempts = 500; // 500ms + while (!QFile::remove(d->fileName) && ++attempts < maxAttempts) { + // Someone is reading the lock file right now (on Windows this prevents deleting it). + QThread::msleep(1); + } + if (attempts == maxAttempts) { + qWarning() << "Could not remove our own lock file" << d->fileName + << ". Either other users of the lock file are reading it constantly for 500 ms, " + "or we (no longer) have permissions to delete the file"; + // This is bad because other users of this lock file will now have to wait for the + // stale-lock-timeout... + } + d->lockError = QLockFile::NoError; + d->isLocked = false; } QT_END_NAMESPACE |