Go to file
Marc Mutz 319c478603 QReadWriteLock: replace (QWaitCondition, QMutex) with std::(condition_variable, mutex)
It turns out that QWaitCondition is a std::condition_variable_any. The
_any variant works with any mutex type, but requires a native mutex
for the native condition variable. So, QWaitCondition and
std::condition_variable_any both require two different mutexes: the
one the user passes in, and an internal one.

std::condition_variable, however, only works with std::mutex, and
since both are backed by the native API, condition_variable can use
the mutex passed in by the user instead of having to use an internal
one.

So, port from 2 × QWaitCondition + QMutex (2 × native cond + 2 ×
native mutex + Qt mutex) to std::condition_variable + std::mutex (2 ×
native cond + native mutex), shaving the overhead of two additional
mutexes (one Qt, one native) as well as the memory allocation
performed by QWaitCondition (for its Private).

Speeds up the writeOnly case by ~1/8th:

  PASS   : tst_QReadWriteLock::writeOnly(QReadWriteLock)
  RESULT : tst_QReadWriteLock::writeOnly():"QReadWriteLock":
  -   39,703 msecs per iteration (total: 39,703, iterations: 1)
  +   34,950 msecs per iteration (total: 34,950, iterations: 1)

Change-Id: I196cb13a27242fc1cb99723dfab5b2e5f8522143
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-09-13 10:47:20 +02:00
bin Make sure QLatin1Literal fwd header is generated 2019-09-02 11:33:54 +02:00
config.tests Say hello to Android multi arch build in one go 2019-08-26 12:59:15 +03:00
dist Merge remote-tracking branch 'origin/5.12' into 5.13 2019-09-08 11:33:28 +02:00
doc Merge remote-tracking branch 'origin/5.13' into 5.14 2019-09-09 07:51:49 +00:00
examples Cleanup QtWidgets (tools) examples 2019-09-11 20:36:17 +02:00
lib
mkspecs Merge remote-tracking branch 'origin/5.13' into 5.14 2019-09-13 01:00:15 +02:00
qmake Merge remote-tracking branch 'origin/5.13' into 5.14 2019-09-09 07:51:49 +00:00
src QReadWriteLock: replace (QWaitCondition, QMutex) with std::(condition_variable, mutex) 2019-09-13 10:47:20 +02:00
tests Merge remote-tracking branch 'origin/5.13' into 5.14 2019-09-13 01:00:15 +02:00
util QUnicodeTables: use array for case folding tables 2019-09-04 16:35:37 +00:00
.gitattributes
.gitignore qfloat16: Check in the tables to Git 2019-06-03 10:42:53 -07:00
.qmake.conf Require opt-out for using QLinkedList 2019-08-07 20:09:10 +00:00
.tag
config_help.txt Merge remote-tracking branch 'origin/5.13' into 5.14 2019-09-04 07:03:54 +02:00
configure Fix typo in configure script 2019-07-24 10:42:16 +09:00
configure.bat Configure: simplify logic 2019-03-14 12:13:58 +00:00
configure.json Make Qt relocatable 2019-09-07 20:02:45 +02:00
configure.pri Make Qt relocatable 2019-09-07 20:02:45 +02:00
header.BSD Use placeholder for year in header.* files 2018-04-16 11:02:22 +00:00
header.COMM Use placeholder for year in header.* files 2018-04-16 11:02:22 +00:00
header.FDL Use placeholder for year in header.* files 2018-04-16 11:02:22 +00:00
header.GPL Use placeholder for year in header.* files 2018-04-16 11:02:22 +00:00
header.GPL-EXCEPT Use placeholder for year in header.* files 2018-04-16 11:02:22 +00:00
header.LGPL Use placeholder for year in header.* files 2018-04-16 11:02:22 +00:00
header.LGPL3 Use placeholder for year in header.* files 2018-04-16 11:02:22 +00:00
header.LGPL3-COMM Use placeholder for year in header.* files 2018-04-16 11:02:22 +00:00
header.LGPL-NOGPL2 Use placeholder for year in header.* files 2018-04-16 11:02:22 +00:00
header.LGPL-ONLY Use placeholder for year in header.* files 2018-04-16 11:02:22 +00:00
header.MIT qsimd: add support for new x86 CPU features 2018-05-05 06:20:07 +00:00
INSTALL INSTALL: Remove outdated reference to Windows CE 2019-02-13 13:01:57 +00:00
LICENSE.FDL
LICENSE.GPL2
LICENSE.GPL3
LICENSE.GPL3-EXCEPT
LICENSE.LGPL3
LICENSE.LGPLv3 Remove LICENSE.GPLv3, LICENSE.LGPLv21, LGPL_EXCEPTION.txt 2018-04-16 11:02:14 +00:00
LICENSE.QT-LICENSE-AGREEMENT-4.0 Replace commercial preview license with Qt License Agreement 4.0 2018-06-21 11:39:15 +00:00
qtbase.pro nuke configure -host-option 2016-12-13 18:55:59 +00:00
sync.profile CMake: Add support for auto-importing plugins in CMake 2019-08-12 18:23:58 +02:00