summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/global/externalsites/external-resources.qdoc215
-rw-r--r--doc/global/externalsites/qt-webpages.qdoc61
-rw-r--r--doc/global/externalsites/rfc.qdoc33
-rw-r--r--src/corelib/doc/src/external-resources.qdoc5
-rw-r--r--src/corelib/thread/qreadwritelock.cpp8
-rw-r--r--src/gui/doc/src/external-resources.qdoc1
-rw-r--r--src/testlib/doc/src/qt-webpages.qdoc4
-rw-r--r--src/widgets/doc/src/external-resources.qdoc6
-rw-r--r--src/xml/doc/src/external-resources.qdoc11
-rw-r--r--tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp106
10 files changed, 111 insertions, 339 deletions
diff --git a/doc/global/externalsites/external-resources.qdoc b/doc/global/externalsites/external-resources.qdoc
index 7a04cca52ce..8670305b00c 100644
--- a/doc/global/externalsites/external-resources.qdoc
+++ b/doc/global/externalsites/external-resources.qdoc
@@ -58,68 +58,27 @@
*/
/*!
- \externalpage https://www.freedesktop.org/wiki/Standards/xembed-spec/
- \title XEmbed Specification
-*/
-
-/*!
- \externalpage https://www.freedesktop.org/wiki/Standards/icon-theme-spec/
- \title Icon Themes Specification
-*/
-
-/*!
\externalpage https://www.cups.org/
\title Common Unix Printing System (CUPS)
\keyword CUPS
*/
/*!
- \externalpage https://www.freedesktop.org/wiki/Specifications/desktop-entry-spec/
- \title Desktop Entry Specification
-*/
-
-/*!
- \externalpage https://kde.org/
- \title The K Desktop Environment
- \keyword KDE
-*/
-
-/*!
\externalpage https://cmake.org/cmake/help/latest/
\title CMake Documentation
*/
/*!
- \externalpage https://cmake.org/cmake/help/latest/command/find_package.html
- \title CMake find_package Documentation
-*/
-
-/*!
\externalpage https://cmake.org/cmake/help/latest/manual/cmake-qt.7.html#automoc
\title CMake AUTOMOC Documentation
*/
/*!
- \externalpage https://cmake.org/cmake/help/latest/manual/cmake-qt.7.html#autorcc
- \title CMake AUTORCC Documentation
-*/
-
-/*!
\externalpage https://cmake.org/cmake/help/latest/manual/cmake-qt.7.html#autouic
\title CMake AUTOUIC Documentation
*/
/*!
- \externalpage https://cmake.org/cmake/help/latest/prop_tgt/LOCATION.html
- \title CMake LOCATION Documentation
-*/
-
-/*!
- \externalpage https://cmake.org/cmake/help/latest/prop_tgt/POSITION_INDEPENDENT_CODE.html
- \title CMake POSITION_INDEPENDENT_CODE Documentation
-*/
-
-/*!
\externalpage https://cmake.org/cmake/help/latest/command/target_link_libraries.html
\title CMake target_link_libraries Documentation
*/
@@ -130,50 +89,11 @@
*/
/*!
- \externalpage https://conan.io/
- \title Conan
-*/
-
-/*!
\externalpage https://www.gnome.org/
\title GNOME
*/
/*!
- \externalpage https://www.gnu.org/software/emacs/
- \title GNU Emacs
-*/
-
-/*!
- \externalpage https://gnuwin32.sourceforge.net/packages.html
- \title GnuWin32 Project
-*/
-
-/*!
- \externalpage https://www.w3.org/Graphics/SVG/About.html
- \title About SVG
- \keyword Scalable Vector Graphics
-*/
-
-/*!
- \externalpage https://www.w3.org/TR/SVG/types.html#ColorKeywords
- \title SVG color keyword names
-*/
-
-/*!
- \externalpage https://www.w3.org/Graphics/SVG/
- \title SVG Working Group
-*/
-
-/*!
- \externalpage https://www.w3.org/TR/SVGMobile/
- \title Mobile SVG Profiles
- \omit
- Mobile SVG Profiles: SVG Tiny and SVG Basic
- \endomit
-*/
-
-/*!
\externalpage https://www.w3.org/TR/SVGMobile12/
\title SVG 1.2 Tiny
*/
@@ -186,36 +106,16 @@
/*!
- \externalpage https://jmeubank.github.io/tdm-gcc/
- \title TDM-GCC
-*/
-
-/*!
\externalpage https://www.dependencywalker.com/
\title Dependency Walker
*/
/*!
- \externalpage https://webkit.org/
- \title WebKit Open Source Project
-*/
-
-/*!
- \externalpage https://www.informit.com/store/c-plus-plus-gui-programming-with-qt4-9780132354165
- \title C++ GUI Programming with Qt 4, 2nd Edition
-*/
-
-/*!
\externalpage https://www.openssl.org/
\title OpenSSL Toolkit
*/
/*!
- \externalpage https://www.activestate.com/platform/supported-languages/perl/
- \title ActivePerl
-*/
-
-/*!
\externalpage https://chromium.googlesource.com/angle/angle/+/master/README.md
\title ANGLE
*/
@@ -226,16 +126,6 @@
*/
/*!
- \externalpage https://www.w3.org/TR/html401/
- \title HTML 4
-*/
-
-/*!
- \externalpage https://html.spec.whatwg.org/multipage/
- \title HTML 5
-*/
-
-/*!
\externalpage https://icu.unicode.org/
\title ICU
*/
@@ -251,41 +141,16 @@
*/
/*!
- \externalpage https://pyxml.sourceforge.net/topics/xbel/
- \title XML Bookmark Exchange Language Resource Page
-*/
-
-/*!
- \externalpage https://www.w3.org/TR/xquery/#errors
- \title error handling in the XQuery language
-*/
-
-/*!
\externalpage https://xaos-project.github.io/
\title XaoS
*/
/*!
- \externalpage https://www.unixodbc.org
- \title https://www.unixodbc.org
-*/
-
-/*!
\externalpage https://www.postgresql.org
\title https://www.postgresql.org
*/
/*!
- \externalpage https://www.postgresql.org/docs/current/installation-platform-notes.html
- \title PostgreSQL MinGW/Native Windows
-*/
-
-/*!
- \externalpage https://www.freetds.org
- \title https://www.freetds.org
-*/
-
-/*!
\externalpage https://www.sqlite.org
\title https://www.sqlite.org
*/
@@ -301,11 +166,6 @@
*/
/*!
- \externalpage https://tldp.org/HOWTO/Framebuffer-HOWTO.html
- \title Framebuffer HOWTO
-*/
-
-/*!
\externalpage https://www.w3.org/TR/scxml/
\title State Chart XML: State Machine Notation for Control Abstraction
*/
@@ -321,71 +181,21 @@
*/
/*!
- \externalpage https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
- \title GNU Lesser General Public License, version 2.1
-*/
-
-/*!
- \externalpage https://www.qtcentre.org
- \title Qt Centre
-*/
-
-/*!
\externalpage https://kde.org
\title KDE
*/
/*!
- \externalpage https://cplusplus.com/reference/cstring/memcpy/
- \title C++ Reference - memcpy
-*/
-
-/*!
\externalpage https://en.cppreference.com/w/cpp/symbol_index/chrono_literals.html
\title chrono_literals Symbol Index
*/
/*!
- \externalpage https://www.w3.org/TR/CSS2/selector.html
- \title Standard CSS2 selector
-*/
-
-/*!
- \externalpage https://www.w3.org/XML/Core/#Publications
- \title W3C XML specifications
-*/
-
-/*!
- \externalpage https://www.w3.org/XML/Schema
- \title XML Schema
-*/
-
-/*!
- \externalpage https://opensource.org/license/bsd-3-clause
- \title New and Modified BSD Licenses
-*/
-
-/*!
- \externalpage https://ecma-international.org/publications-and-standards/standards/ecma-262/
- \title ECMAScript Language Specification
-*/
-
-/*!
\externalpage https://developer.mozilla.org/en-US/docs/Web/JavaScript
\title JavaScript Resources
*/
/*!
- \externalpage https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide
- \title JavaScript Guide
-*/
-
-/*!
- \externalpage https://developer.mozilla.org/en-US/docs/Web/JavaScript
- \title About JavaScript
-*/
-
-/*!
\externalpage https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#keywords
\title JavaScript Reserved Words
*/
@@ -406,41 +216,16 @@
*/
/*!
- \externalpage https://registry.khronos.org/OpenGL/index_gl.php
- \title OpenGL Registry
-*/
-
-/*!
- \externalpage https://registry.khronos.org/OpenGL/index_es.php
- \title Khronos OpenGL ES API Registry
-*/
-
-/*!
\externalpage https://www.khronos.org/opengl/wiki/Array_Texture
\title Array Texture
*/
/*!
- \externalpage https://github.com/iksaif/qsslkey-p11
- \title qsslkey example
-*/
-
-/*!
\externalpage https://www.w3.org/TR/2009/WD-webdatabase-20091029/
\title HTML5 Web Database API
*/
/*!
- \externalpage https://lldb.llvm.org/
- \title The LLDB Debugger
-*/
-
-/*!
- \externalpage https://account.qt.io/s/
- \title Qt Account Sign-up
-*/
-
-/*!
\externalpage https://facebook.github.io/zstd/
\title Zstandard Site
*/
diff --git a/doc/global/externalsites/qt-webpages.qdoc b/doc/global/externalsites/qt-webpages.qdoc
index 7b659fa5295..6cbf5f377b6 100644
--- a/doc/global/externalsites/qt-webpages.qdoc
+++ b/doc/global/externalsites/qt-webpages.qdoc
@@ -17,76 +17,15 @@
\title The Qt Company
*/
/*!
- \externalpage http://qt.io/licensing/
- \title Qt Licensing Overview
-*/
-/*!
- \externalpage http://doc.qt.io/archives/qq/
- \title Qt Quarterly
-*/
-/*!
- \externalpage http://doc.qt.io/archives/qq/qq19-plurals.html
- \title Qt Quarterly: Plural Form in Translation
-*/
-/*!
\externalpage https://code.qt.io/
\title Public Qt Repository
*/
/*!
- \externalpage https://code.qt.io/cgit/%7bnon-gerrit%7d/qt-labs/qtestlib-tools.git/
- \title qtestlib-tools
-*/
-
-/*!
- \externalpage http://wiki.qt.io/Qt_Coding_Style
- \title Qt Coding Style
-*/
-/*!
- \externalpage http://doc.qt.io/archives/qt-eclipse-1.6/index.html
- \title Eclipse Plugin
-*/
-/*!
- \externalpage http://doc.qt.io/archives/qq/qq11-events.html
- \title Qt Quarterly: Another Look at Events
-*/
-/*!
- \externalpage https://www.youtube.com/watch?v=P4kv-AoAJ-Q
- \title Livecoding video effects with Qt5
-*/
-/*!
- \externalpage http://blog.qt.io/2012/02/29/pimp-my-video-shader-effects-and-multimedia/
- \title Pimp my video
-*/
-/*!
- \externalpage http://wiki.qt.io/QtMediaHub
- \title QtMediaHub
-*/
-/*!
- \externalpage http://wiki.qt.io/Qt_RaspberryPi
- \title QtonPi
-*/
-
-/*!
- \externalpage http://wiki.qt.io/jom
- \title jom
-*/
-
-/*!
- \externalpage http://doc.qt.io/qt-4.8
- \title Qt 4.8 Reference Documentation
-*/
-
-/*!
\externalpage http://wiki.qt.io/Qt_Localization
\title external: Translating Qt Into Other Languages
*/
/*!
- \externalpage http://wiki.qt.io/Qt_Multimedia_Backends
- \title Qt Multimedia Backends
-*/
-
-/*!
\externalpage https://doc.qt.io/qt3dstudio/index.html
\title Qt 3D Studio Manual
*/
diff --git a/doc/global/externalsites/rfc.qdoc b/doc/global/externalsites/rfc.qdoc
index d0c127fb41e..071977b9a0e 100644
--- a/doc/global/externalsites/rfc.qdoc
+++ b/doc/global/externalsites/rfc.qdoc
@@ -12,12 +12,6 @@
*/
/*!
- \externalpage https://datatracker.ietf.org/doc/html/rfc1179
- \title RFC 1179
- \keyword lpr
-*/
-
-/*!
\externalpage https://datatracker.ietf.org/doc/html/rfc1738
\title RFC 1738
*/
@@ -28,43 +22,16 @@
*/
/*!
- \externalpage https://datatracker.ietf.org/doc/html/rfc1928
- \title RFC 1928
-*/
-
-/*!
- \externalpage https://datatracker.ietf.org/doc/html/rfc1929
- \title RFC 1929
-*/
-
-/*!
\externalpage https://datatracker.ietf.org/doc/html/rfc2045
\title RFC 2045
*/
/*!
- \externalpage https://datatracker.ietf.org/doc/html/rfc2109
- \title RFC 2109
- HTTP State Management Mechanism
-*/
-
-/*!
\externalpage https://datatracker.ietf.org/doc/html/rfc2822
\title RFC 2822
*/
/*!
- \externalpage https://datatracker.ietf.org/doc/html/rfc2965
- \title RFC 2965
- HTTP State Management Mechanism
-*/
-
-/*!
- \externalpage https://datatracker.ietf.org/doc/html/rfc3174
- \title RFC 3174
-*/
-
-/*!
\externalpage https://datatracker.ietf.org/doc/html/rfc3491
\title RFC 3491
*/
diff --git a/src/corelib/doc/src/external-resources.qdoc b/src/corelib/doc/src/external-resources.qdoc
index 2232b49bf23..5d357c65496 100644
--- a/src/corelib/doc/src/external-resources.qdoc
+++ b/src/corelib/doc/src/external-resources.qdoc
@@ -28,11 +28,6 @@
*/
/*!
- \externalpage https://marcmutz.wordpress.com/effective-qt/containers/#containers-qlist
- \title Pros and Cons of Using QList
-*/
-
-/*!
\externalpage https://marcmutz.wordpress.com/effective-qt/containers/
\title Understand the Qt Containers
*/
diff --git a/src/corelib/thread/qreadwritelock.cpp b/src/corelib/thread/qreadwritelock.cpp
index 96e35dcb965..2a1af2315ca 100644
--- a/src/corelib/thread/qreadwritelock.cpp
+++ b/src/corelib/thread/qreadwritelock.cpp
@@ -234,14 +234,14 @@ QBasicReadWriteLock::contendedTryLockForRead(QDeadlineTimer timeout, void *dd)
return d->recursiveLockForRead(timeout);
auto lock = qt_unique_lock(d->mutex);
- if (d != d_ptr.loadRelaxed()) {
+ if (QReadWriteLockPrivate *dd = d_ptr.loadAcquire(); d != dd) {
// d_ptr has changed: this QReadWriteLock was unlocked before we had
// time to lock d->mutex.
// We are holding a lock to a mutex within a QReadWriteLockPrivate
// that is already released (or even is already re-used). That's ok
// because the QFreeList never frees them.
// Just unlock d->mutex (at the end of the scope) and retry.
- d = d_ptr.loadAcquire();
+ d = dd;
continue;
}
return d->lockForRead(lock, timeout);
@@ -340,11 +340,11 @@ QBasicReadWriteLock::contendedTryLockForWrite(QDeadlineTimer timeout, void *dd)
return d->recursiveLockForWrite(timeout);
auto lock = qt_unique_lock(d->mutex);
- if (d != d_ptr.loadRelaxed()) {
+ if (QReadWriteLockPrivate *dd = d_ptr.loadAcquire(); d != dd) {
// The mutex was unlocked before we had time to lock the mutex.
// We are holding to a mutex within a QReadWriteLockPrivate that is already released
// (or even is already re-used) but that's ok because the QFreeList never frees them.
- d = d_ptr.loadAcquire();
+ d = dd;
continue;
}
return d->lockForWrite(lock, timeout);
diff --git a/src/gui/doc/src/external-resources.qdoc b/src/gui/doc/src/external-resources.qdoc
index 0f356dd5046..14ed0817e62 100644
--- a/src/gui/doc/src/external-resources.qdoc
+++ b/src/gui/doc/src/external-resources.qdoc
@@ -36,6 +36,7 @@
\externalpage https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
\title Freedesktop Icon Naming Specification
*/
+
/*!
\externalpage https://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html#directory_layout
\title Icon Theme Specification - Directory Layout
diff --git a/src/testlib/doc/src/qt-webpages.qdoc b/src/testlib/doc/src/qt-webpages.qdoc
index 611f3795ba9..b32fd4f750f 100644
--- a/src/testlib/doc/src/qt-webpages.qdoc
+++ b/src/testlib/doc/src/qt-webpages.qdoc
@@ -15,7 +15,3 @@
\title Googletest Mocking (gMock) Framework
*/
-/*!
- \externalpage https://www.itk.org/Wiki/CMake_Testing_With_CTest
- \title CMake/Testing With CTest
-*/
diff --git a/src/widgets/doc/src/external-resources.qdoc b/src/widgets/doc/src/external-resources.qdoc
index 96117546a29..0eccc3b19d4 100644
--- a/src/widgets/doc/src/external-resources.qdoc
+++ b/src/widgets/doc/src/external-resources.qdoc
@@ -1,12 +1,6 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-/*!
- \externalpage http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/index.html
- \title Apple Human Interface Guidelines
-*/
-
/*!
\externalpage https://rk.nvg.ntnu.no/sinclair/computers/zxspectrum/zxspectrum.htm
\title Sinclair Spectrum
diff --git a/src/xml/doc/src/external-resources.qdoc b/src/xml/doc/src/external-resources.qdoc
index 89c30a84c47..89552477ae8 100644
--- a/src/xml/doc/src/external-resources.qdoc
+++ b/src/xml/doc/src/external-resources.qdoc
@@ -1,17 +1,6 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-/*!
- \externalpage http://www.w3.org/2000/xmlns/
- \title http://www.w3.org/2000/xmlns/
-*/
-
-/*!
- \externalpage http://www.saxproject.org/
- \title SAX2 Java interface
-*/
-
/*!
\externalpage http://www.w3.org/TR/DOM-Level-2-Core/
\title W3C DOM Level 2
diff --git a/tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp b/tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp
index 86dfa5faffc..4c089091f8d 100644
--- a/tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp
+++ b/tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp
@@ -57,6 +57,7 @@ private slots:
void multipleReadersLoop();
void multipleWritersLoop();
void multipleReadersWritersLoop();
+ void heavyLoadLocks();
void countingTest();
void limitedReaders();
void deleteOnUnlock();
@@ -603,6 +604,111 @@ public:
}
};
+class HeavyLoadLockThread : public QThread
+{
+public:
+ QReadWriteLock &testRwlock;
+ const qsizetype iterations;
+ const int numThreads;
+ inline HeavyLoadLockThread(QReadWriteLock &l, qsizetype iters, int numThreads, QVector<QAtomicInt *> &counters):
+ testRwlock(l),
+ iterations(iters),
+ numThreads(numThreads),
+ counters(counters)
+ { }
+
+private:
+ QVector<QAtomicInt *> &counters;
+ QAtomicInt *getCounter(qsizetype index)
+ {
+ QReadLocker locker(&testRwlock);
+ /*
+ The index is increased monotonically, so the index
+ being requested should be always within or at the end of the
+ counters vector.
+ */
+ Q_ASSERT(index <= counters.size());
+ if (counters.size() <= index || counters[index] == nullptr) {
+ locker.unlock();
+ QWriteLocker wlocker(&testRwlock);
+ if (counters.size() <= index)
+ counters.resize(index + 1, nullptr);
+ if (counters[index] == nullptr)
+ counters[index] = new QAtomicInt(0);
+ return counters[index];
+ }
+ return counters[index];
+ }
+ void releaseCounter(qsizetype index)
+ {
+ QWriteLocker locker(&testRwlock);
+ delete counters[index];
+ counters[index] = nullptr;
+ }
+
+public:
+ void run() override
+ {
+ for (qsizetype i = 0; i < iterations; ++i) {
+ QAtomicInt *counter = getCounter(i);
+ /*
+ Here each counter is accessed by each thread
+ and increaed only once. As a result, when the
+ counter reaches numThreads, i.e. the fetched
+ value before the increment is numThreads-1,
+ we know all threads have accessed this counter
+ and we can delete it safely.
+ */
+ int prev = counter->fetchAndAddRelaxed(1);
+ if (prev == numThreads - 1) {
+#ifdef QT_BUILDING_UNDER_TSAN
+ /*
+ Under TSAN, deleting and freeing an object
+ will trigger a write operation on the memory
+ of the object. Since we used fetchAndAddRelaxed
+ to update the counter, TSAN will report a data
+ race when deleting the counter here. To avoid
+ the false positive, we simply reset the counter
+ to 0 here, with ordered semantics to establish
+ the sequence to ensure the the free-ing option
+ happens after all fetchAndAddRelaxed operations
+ in other threads.
+
+ When not building under TSAN, deleting the counter
+ will not result in any data read or written to the
+ memory region of the counter, so no data race will
+ happen.
+ */
+ counter->fetchAndStoreOrdered(0);
+#endif
+ releaseCounter(i);
+ }
+ }
+ }
+};
+
+/*
+ Multiple threads racing acquiring and releasing
+ locks on the same indices.
+*/
+
+void tst_QReadWriteLock::heavyLoadLocks()
+{
+ constexpr qsizetype iterations = 65536 * 4;
+ constexpr int numThreads = 8;
+ QVector<QAtomicInt *> counters;
+ QReadWriteLock testLock;
+ std::array<std::unique_ptr<HeavyLoadLockThread>, numThreads> threads;
+ for (auto &thread : threads)
+ thread = std::make_unique<HeavyLoadLockThread>(testLock, iterations, numThreads, counters);
+ for (auto &thread : threads)
+ thread->start();
+ for (auto &thread : threads)
+ thread->wait();
+ QVERIFY(counters.size() == iterations);
+ for (qsizetype i = 0; i < iterations; ++i)
+ QVERIFY(counters[i] == nullptr);
+}
/*
A writer acquires a read-lock, a reader locks