summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-181-7/+12
|\ | | | | | | Change-Id: Ia79c2457f20f3428ef1b4358c1094e8dc1bbc33e
| * Fix memory leak on new QThreadPool::tryStart versionAllan Sandfeld Jensen2020-03-171-7/+12
| | | | | | | | | | | | | | | | Also documents the ownership of the traditional tryStart better, and remove a redundant check. Change-Id: I06202465b782926724fa33a901d08c1626f87373 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* | Add support for attaching continuations to QFutureSona Kurazyan2020-03-057-7/+645
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added QFuture::then() methods to allow chaining multiple asynchronous computations. Continuations can use the following execution policies: * QtFuture::Launch::Sync - the continuation will be launched in the same thread in which the parent has been executing. * QtFuture::Launch::Async - the continuation will be launched in a new thread. * QtFuture::Launch::Inherit - the continuation will inherit the launch policy of the parent, or its thread pool (if it was using a custom one). * Additionally then() also accepts a custom QThreadPool* instance. Note, that if the parent future gets canceled, its continuation(s) will be also canceled. If the parent throws an exception, it will be propagated to the continuation's future, unless it is caught inside the continuation (if it has a QFuture arg). Some example usages: QFuture<int> future = ...; future.then([](int res1){ ... }).then([](int res2){ ... })... QFuture<int> future = ...; future.then([](QFuture<int> fut1){ /* do something with fut1 */ })... In the examples above all continuations will run in the same thread as future. QFuture<int> future = ...; future.then(QtFuture::Launch::Async, [](int res1){ ... }) .then([](int res2){ ... }).. In this example the continuations will run in a new thread (but on the same one). QThreadPool pool; QFuture<int> future = ...; future.then(&pool, [](int res1){ ... }) .then([](int res2){ ... }).. In this example the continuations will run in the given thread pool. [ChangeLog][QtCore] Added support for attaching continuations to QFuture. Task-number: QTBUG-81587 Change-Id: I5b2e176694f7ae8ce00404aca725e9a170818955 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devLars Knoll2020-02-284-19/+19
|\| | | | | | | Change-Id: I469b0501cc65fc5ce4d797a69ae89405cc69c7f8
| * Improve argument name for std::function argumentAllan Sandfeld Jensen2020-02-264-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | Less \a fun though. Note using references in this API would just duplicate the API, but still end up with a copy when creating the QRunnable. By having the copy apparent directly in the API, we not only save the duplication, we also hint to the caller to use move if they want to avoid a copy. Change-Id: If11476d4b38853839c1e87e0339807a1798fc875 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-02-261-6/+0
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/network/bearermonitor/CMakeLists.txt examples/network/CMakeLists.txt src/corelib/tools/qlinkedlist.h src/sql/kernel/qsqldriver_p.h src/sql/kernel/qsqlresult_p.h src/widgets/kernel/qwidget.cpp src/widgets/kernel/qwidget_p.h tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp tests/auto/tools/moc/allmocs_baseline_in.json Change-Id: I21a3c34570ae79ea9d30107fae71759d7eac17d9
| * Doc: Fix documentation warnings for Qt CoreTopi Reinio2020-02-251-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - QCborError: Classes cannot relate to header files; use \inheaderfile instead and link to the class from header file documentation. - QRecursiveMutex: QDoc doesn't allow shared documentation comments for duplicating \fn docs between the base and deriving classes. Remove the sharing, the function documentation is available under 'All Members' doc for QRecursiveMutex. - QMultiMap: unite() and one overload of insert() were not recognized because their definitions in the same header file interfered with QDoc - use Q_CLANG_QDOC macro to comment them out, and tag \fn comments to ensure that the function documentation is matched. Change-Id: Ic96869904a72d92453e4ffa6901000147571969b Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devLiang Qi2020-02-134-0/+66
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/widgets/graphicsview/boxes/scene.h src/corelib/Qt5CoreMacros.cmake src/corelib/Qt6CoreMacros.cmake src/network/ssl/qsslsocket.cpp src/network/ssl/qsslsocket.h src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp src/testlib/CMakeLists.txt src/testlib/.prev_CMakeLists.txt tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp Disabled building manual tests with CMake for now, because qmake doesn't do it, and it confuses people. Done-With: Alexandru Croitor <alexandru.croitor@qt.io> Done-With: Volker Hilsheimer <volker.hilsheimer@qt.io> Change-Id: I865ae347bd01f4e59f16d007b66d175a52f1f152
| * Add a constructor for QRunnable from anonymous functionsAllan Sandfeld Jensen2020-01-314-0/+66
| | | | | | | | | | | | | | | | | | | | This makes it easier to create one without having to create a derivative class. The patch also adds a path to avoid using QRunnable directly in QThreadPool. Change-Id: I9caa7dabb6f641b547d4771c863aa6ab7f01b704 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* | Remove comments about destructors needing to be emptyJan Arve Sæther2020-02-111-1/+0
| | | | | | | | | | | | | | | | Not important, but removes some ### Qt6 comments from my radar Change-Id: Ifd1bf44c44ece8fa1314d3c7e0e95d1bd37ae0ea Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-01-283-4/+6
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qsettings.cpp src/corelib/kernel/qvariant.cpp src/corelib/serialization/qjsoncbor.cpp src/corelib/serialization/qjsonvalue.cpp src/corelib/tools/tools.pri src/gui/image/qimage.cpp src/gui/kernel/qguivariant.cpp src/widgets/kernel/qshortcut.cpp tests/auto/tools/moc/allmocs_baseline_in.json tests/auto/tools/moc/tst_moc.cpp src/opengl/qglframebufferobject.cpp Done-With: Edward Welbourne <edward.welbourne@qt.io> Done-With: Leander Beernaert <leander.beernaert@qt.io> Change-Id: Ie7f5fa646c607fe70c314bf7195f7578ded1d271
| * QThread::setPriority() Warn about invalid parameter on all platformsFriedemann Kleint2020-01-272-3/+5
| | | | | | | | | | | | | | | | | | | | | | InheritPriority may not be set, but the warning only occurs on Windows. Move the warning to the public class. Change-Id: I51d401300f840e4c1396c2c30182e49ed45d60d2 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
| * Doc: Replace some usages of 0/zero/null with \nullptrSze Howe Koh2020-01-271-1/+1
| | | | | | | | | | Change-Id: Ibe7de11fc6fc41477c35e7d653c6a911855deabb Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devLiang Qi2020-01-045-83/+146
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qvector.h Make QVector(DataPointer dd) public to be able to properly merge 5b4b437b30b320e2cd7c9a566999a39772e5d431 from 5.15 into dev. src/widgets/kernel/qapplication.cpp tests/auto/tools/moc/allmocs_baseline_in.json Done-With: Christian Ehrlicher <ch.ehrlicher@gmx.de> Change-Id: I929ba7c036d570382d0454c2c75f6f0d96ddbc01
| * Merge remote-tracking branch 'origin/5.14' into 5.15Liang Qi2019-12-162-68/+142
| |\ | | | | | | | | | | | | | | | | | | | | | Conflicts: src/network/ssl/qsslsocket.cpp src/widgets/kernel/qapplication.cpp Change-Id: Ib7421cc2df59d0969f89b3fbd65a17ea76ffef3b
| | * Doc: Fix qdoc compilation errors qtbaseNico Vertriest2019-12-122-68/+142
| | | | | | | | | | | | | | | | | | Task-number: QTBUG-79824 Change-Id: I6557de598de1931fc30556951d35783d02b83abe Reviewed-by: Paul Wicking <paul.wicking@qt.io>
| * | QWaitCondition: un-deprecate wait() functions with ulong argChristian Ehrlicher2019-12-123-15/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The wait() functions with the unsigned long arg were marked for removal for Qt6 but due to the high usage of this functions and the very small gain, revert the deprecation. Change-Id: I9c9b720d279a59d87730f51de0f321b3794aa88e Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-12-112-7/+7
|\| | | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp Change-Id: I6b82507bf9a80a374c40393e72f4843f1557de89
| * | Merge remote-tracking branch 'origin/5.14' into 5.15Liang Qi2019-12-102-7/+7
| |\| | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/network/kernel/qnetworkinterface/BLACKLIST Change-Id: I1e8866c63b54bcd95fc2a044276ee15b7f60e79a
| | * Don't wrap feature detection macros with QT_HAS_FOO() variantsTor Arne Vestbø2019-12-102-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using wrappers for these macros is problematic when for example passing the -frewrite-includes flag to preprocess sources before shipping off to distcc or Icecream. It will also start producing warnings when compilers implement http://eel.is/c++draft/cpp.cond#7.sentence-2. See for example https://reviews.llvm.org/D49091 Both https://clang.llvm.org/docs/LanguageExtensions.html and the SD-6 document at https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations recommend defining '__has_foo(x) 0' as a fallback for compilers without the macros, so that's what we go for. Change-Id: I0298cd3b4a6ff6618821e34642a5ddd6728be767 Reviewed-by: Alex Richardson <arichardson.kde@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-12-0911-34/+34
|\| | | | | | | | | | | Change-Id: Ia24cc8b86def0d9d9c17d6775cc519e491b860b1
| * | Tidy nullptr usageAllan Sandfeld Jensen2019-12-0611-34/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-11-301-3/+3
|\| | | | | | | | | | | Change-Id: Icbb60f8c1891ec2779575276495199ace9d3d6c3
| * | INTEGRITY: remove constexpr supportGiuseppe D'Angelo2019-11-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It doesn't seem to be working correctly with array of literal types, blocking the patch refactoring the webgradient support: 10171: "painting/webgradients.cpp", line 79: error #28: expression must have a constant value Change-Id: I9ddd768d24ef79dd7a69e23c91988d891e41d4b9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-11-259-45/+86
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qhash.h src/gui/kernel/qevent.h src/widgets/kernel/qshortcut.cpp src/widgets/kernel/qshortcut.h Change-Id: If61c206ee43ad1d97f5b07f58ac93c4583ce5620
| * | Port QThread::wait() to QDeadlineTimerChristian Ehrlicher2019-11-134-16/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | So we are in sync with QWaitCondition::wait(). Task-number: QTBUG-64266 Change-Id: I1d7487786513241cedd35d202c4ddee4937b08ec Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * | QWaitCondition: fix dummy QWaitCondition implementationChristian Ehrlicher2019-11-081-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The dummy implementation of QWaitCondition which is used when the thread feature is not available lacks some functions which were recently added. So we have to add them now. Change-Id: I32720e0857a1bd3fcf0e70078404a38dd8a8ca88 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * | QWaitCondition: mark obsolete functions as deprecatedChristian Ehrlicher2019-11-076-24/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | Mark QWaitCondition:wait(..., ulong) as deprecated so they can be removed in Qt6. Also replace the usages of this deprecated functions inside QtCore. Change-Id: I77313255fa05f5c112b0b40d4c55339cc4f85346 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-11-011-0/+10
|\| | | | | | | | | | | Change-Id: I68a6ed3184e62fa89c47c564bb01002c0918d0fd
| * | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-10-301-0/+10
| |\| | | | | | | | | | Change-Id: Ib4df563fc7b1f7c40f425e0e71180d9517a672be
| | * no-thread: Add dummy implementations for stackSize functions in QThreadEskil Abrahamsen Blomfeldt2019-10-281-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We recently added a call to setStackSize() in the QML thread, which revealed that the dummy implementation for this function was missing in no-thread builds. Fixes: QTBUG-79571 Change-Id: Ibabb48d9cba73afda0842642045a2961e65523f9 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | | Read a unique thread identifier from CPU registersVolker Hilsheimer2019-10-204-6/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is, depending on the implementation of pthread, significantly cheaper than using a pthread library call. Even if we don't know the assembler for an architecture, taking the address of the thread_local variable is still faster. As QThread::currentThreadId() is documented to be used internally and not meant for application code, we don't have to care about what exact value we return. Internally, we use it only to compare thread IDs for equality, which this implementation is sufficient for, even if a thread ID is re-used when one of the threads terminate and a new thread starts (since the other thread is still executing code). Besides, pthread_self documents [0] that a thread ID may be reused, and that the returned pthread_t cannot be portably compared using operator==(); using pthread_equal would require adding a Qt thread-ID type that implements this correctly, and would make things even slower. [0] http://man7.org/linux/man-pages/man3/pthread_self.3.html Change-Id: Id08e79b9b9c88976561f7cd36c66d43771fc4f24 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-10-022-0/+154
|\| | | | | | | | | | | Change-Id: Ideaa64d583746f1ce8265997131fb1ce3a9acbcf
| * | Short live QtPrivate::{condition_variable,mutex}!Marc Mutz2019-09-272-0/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a temporary measure to work around an implementation bug on Integrity: For all other platforms, QtPrivate::condition_variable is just std::condition_variable. On Integrity, it's a class that wraps QWaitCondition to provide the interface of std::condition_variable. This allows the use of std::condition_variable across Qt without running into the Integrity issue. Once we can depend on an more modern Integrity toolchain, removing QtPrivate::condition_variable is a simple mechanical change: s/QtPrivate::condition_variable/std::condition_variable/g; s/QtPrivate::mutex/std::mutex/g; Task-number: QTBUG-78450 Change-Id: I293a99d1cdc48691817b926aa51ecd84556e5e90 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-09-222-29/+22
|\| | | | | | | | | | | Change-Id: Ic274a375d6fc1312ced2354e034dc0980dd47c51
| * | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-09-192-29/+22
| |\| | | | | | | | | | Change-Id: I46ec05ade1c84e61f7f45562a218aa9ff55e2975
| | * Revert "QReadWriteLock: replace (QWaitCondition, QMutex) with ↵Jani Heikkinen2019-09-192-29/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | std::(condition_variable, mutex)" This reverts commit 319c4786036b5f45fc95c683cef5cf5ba2ce2a6d. Reason for revert: QTBUG-78450 Change-Id: Ifaea83626296508558591d4ff207d4e0c883f841 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2019-09-173-42/+52
|\| | | | | | | | | | | Change-Id: Ic1fd51143f903b7e9086fc19ca960dfd9654ee00
| * | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-09-171-4/+8
| |\| | | | | | | | | | Change-Id: I4d7f0e35f4a6ccb6d5494f947fd82fc276feadd3
| | * Revert "Revert "Deprecate QAtomic::load() / store()""Giuseppe D'Angelo2019-09-161-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 5859f7d0d9440f82086486639a707f3935696cf4. Reason for revert: the blocker for qtdeclarative has been merged (in qtdeclarative/c060f6e765a2f155b38158f2ed73eac4aad37e02). Change-Id: Ie69cb1567417173f543e88f659658fe03ba28830 Reviewed-by: Liang Qi <liang.qi@qt.io>
| * | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-09-162-38/+44
| |\| | | | | | | | | | Change-Id: Ie24be82ee70bf103c2664de1a42741979262b10c
| | * QReadWriteLock: replace (QWaitCondition, QMutex) with ↵Marc Mutz2019-09-132-22/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * Port QReadWriteLock from QMutexLocker to qt_unique_lockMarc Mutz2019-09-131-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Most of these are unique_locks because they call QWaitCondition::wait() and it doesn't feel right to use qt_scoped_lock if the lock is dropped within the scope. Change-Id: I506eede63008dad135c21112e578da4f7684e528 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
| | * QReadWriteLock: use NSDMI to simplify the Private ctorMarc Mutz2019-09-121-10/+8
| | | | | | | | | | | | | | | | | | Change-Id: I7267dedb152186ad8c74cbf2eddd863c3bc0845f Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | | QFutureInterface: clean up mutex() method for Qt 6Marc Mutz2019-09-122-13/+7
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | Ditch the QMutex *mutex() method that we had to keep around for binary compatibility and drop the disambiguation argument of QMutex &mutex(int) now that we don't need it anymore. The lock_guard lines now look dangerously close to C++'s Most Vexing Parse, so use braced initialization to make sure it's parsed as a definition, not a declaration. Change-Id: Ie3d70f58c9878ab6d7da8f8bd72a4cb4aff83bb7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* / QSemaphoreReleaser: two minor code improvementsMarc Mutz2019-09-051-5/+2
|/ | | | | | | | | - use qExchange() in cancel() - use cancel() instead of manual pointer manipulations in the move ctor Change-Id: Ica3a3a1e339500c5e5a0c0646e7a95c7c5d435db Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QReadWriteLock QT_NO_THREAD shell: make API compatible with the regular oneMarc Mutz2019-08-281-14/+14
| | | | | | | | | | | | | - add missing explicit - drop static from member functions that aren't static in the regular version (ie. all functions) As a drive-by, remove redundant inline keyword where it doesn't cause wanton inconsistency with surrounding code. Change-Id: I5aed73c3afa85d98d97b57c2c1874b1a5e664960 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Merge remote-tracking branch 'origin/dev' into 5.14Liang Qi2019-08-271-22/+1
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: src/widgets/kernel/qwidget.cpp src/widgets/kernel/qwidget_p.h src/widgets/kernel/qwidgetrepaintmanager.cpp src/widgets/kernel/qwidgetwindow.cpp tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp Change-Id: Ifae457d0427be8e2465e474b055722e11b3b1e5c
| * Remove workaround for compilers not supporting thread_localVolker Hilsheimer2019-08-201-22/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With C++11, all compilers support thread_local, which replaces the non- standardized __thread attribute as a storage class. The storage class was specifically introduced so that applications do not have to deal with pthread APIs for TLS key management. We still need to have some of that logic for adopting foreign threads, but we can rely on thread_local so that we get a fast implementation of QThread::currentThread() on all platforms. Change-Id: Iba2b35d014044c4ab317a0e127c5d1f1fa4ecd4a Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Port away from QMutexLocker in public headersMarc Mutz2019-08-252-5/+13
|/ | | | | | | | | | | | | | | | | We can't use qt_scoped_lock/qt_unique_lock here, so port to std::unique_lock and std::lock_guard for now. This is in preparation of deprecating QMutexLocker in favor of std::unique_lock and std::scoped_lock. In QFutureInterface, change the return type of mutex() from QMutex* to QMutex&, so we don't need to deref when passing to std::lock_guard. We need to keep the old method around for BC reasons, so the new one needs an artificial function argument for disambiguation. This will vanish come Qt 6. Change-Id: I1a0f0205952a249512ec2dbd3f0f48dd209b1636 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>