summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qthread.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QThread/Doc: update the docs on setStackSize()Thiago Macieira25 min.1-4/+12
| | | | | | | | | | There's some confusion about minimum and maximum. Pick-to: 6.7 Fixes: QTBUG-109512 Change-Id: I262c3499666e4f4fbcfbfffd17cc1d592bc658b3 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Philip Van Hoof <philip@codeminded.be>
* QThread: Reuse isMainThread()Jarek Kobus8 days1-4/+4
| | | | | | | Internally, reuse threadId and theMainThreadId. Change-Id: Iea6e7d8fcbcaf7e2f4dbf8ab33890d0f7954edc0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QThread: Introduce static isMainThread() helperJarek Kobus11 days1-3/+23
| | | | | | | | | | | | Useful for QtCreator, as a replacement for Utils::isMainThread() inside threadutils.h, may serve for other projects, too. Introduce static QCoreApplicationPrivate::theMainThreadId atomic helper field holding the id of the main thread. Change-Id: Iccc0302f423f47b5ecad86c4cd3de4d1ee36155f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QThread: Introduce isCurrentThreadFabian Kosmale11 days1-0/+35
| | | | | | | | | | This allows a more efficient way of checking whether a thread is the currently executing one (without using private API). Change-Id: I007edae6b258d7e42e901fa720d4f3cf9fe25a49 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: David Faure <david.faure@kdab.com>
* Mention QChronoTimer in API docsAhmad Samir2024-03-031-1/+1
| | | | | Change-Id: Iaf9fb31994f1580b2051dbd0b1b8eef2a218aa39 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* wasm: fix single thread apps build QScopedScopeLevelCounterLorn Potter2023-12-281-0/+2
| | | | | | | | | QScopedScopeLevelCounter was added and it doesn't really need threads to function, but apps fail to link without it. Change-Id: I7b355369079bc11b8b8b45b3ee1bf5ba81cd1953 Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* wasm: fix single thread buildLorn Potter2023-12-221-0/+4
| | | | | | | | Fixes linking of apps Pick-to: 6.6 6.7 Change-Id: I9bbec9b63af8ae2801643fe124aeda8b25abeca5 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Add categorized logging of delete later machineryTor Arne Vestbø2023-12-211-0/+15
| | | | | | | | | A QT_MESSAGE_PATTERN including %{backtrace depth=4} should give the call site of the QScopedScopeLevelCounter. Task-number: QTBUG-120124 Change-Id: Ie477994882bde9168c931479102017ad5fde426a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Doc: Remove references to Qt 4 in Qt 5.0 in Qt Core documentationKai Köhne2023-12-181-5/+4
| | | | | | | Pick-to: 6.6 6.7 Change-Id: Ide0c1ed441c923753f1e81141460719161662c15 Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io> Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
* Revamp Wait Conditions Example: Revisit the documentationRym Bouabid2023-09-131-1/+1
| | | | | | | | | | | | | | Change the title. Remove the first \brief as there are two briefs in the document so that the new title makes sense with the second brief in "All Qt Examples" doc page. Task-number: QTBUG-108860 Pick-to: 6.6 6.5 Change-Id: I1dec2ad107e3f9ff9b4203960ba54ae6d0d8c7b6 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
* Revamp Semaphores example: Revisit the documentationRym Bouabid2023-09-131-1/+2
| | | | | | | | | | | | | Change the title. Remove the first \brief as there are two briefs in the document so that the new title makes sense with the second brief in "All Qt Examples" doc page. Task-number: QTBUG-108859 Pick-to: 6.6 6.5 Change-Id: I8b0370c9a85179e172918231ae48a3c52845bf21 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Revamp Mandelbrot example: Revisit the documentatonRym Bouabid2023-09-131-2/+2
| | | | | | | | | | | | | | | Remove "Example" from the title. Edit the link (title) to the documentation of Mandelbrot in QThread documentation. Delete the foreach related sentence as we are trying to port away from this Qt pseudo-keyword. Task-number: QTBUG-108861 Pick-to: 6.6 6.5 6.6.0 Change-Id: I6d04f24ac9c1fa1efe30a947c2da2ec7475edc80 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* CMake: remove check for cxx11_futureThiago Macieira2023-08-021-2/+0
| | | | | | | | | | | Everyone must have this by now. This test was 1193 ms of CMake time. Since this was a PUBLIC feature, I've left it around with a constant condition. Change-Id: Ifbf974a4d10745b099b1fffd177754538bbff245 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QtCore: code tidies: use the 4-arg connect overloadGiuseppe D'Angelo2023-06-241-1/+3
| | | | | | | | The 3-arg connect is error-prone and makes the lifetime of the connection unclear. Change-Id: I4f2b54bc086e8f4723a0357d983e3df2f85135ac Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QThread: add sleep(std::chrono::nanoseconds) overloadAhmad Samir2023-03-131-13/+23
| | | | | | | | | | | | | | All the other overloads are implemented using the new one. Windows change relies on the pre-check in the code review making sure it compiles. [ChangeLog][QtCore][QThread] Added sleep(std::chrono::nanoseconds) overload. Task-number: QTBUG-110059 Change-Id: I9a4f4bf09041788ec9275093b6b8d0386521e286 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QThread: add empty functions for the no-thread buildMorten Sørvig2022-08-261-0/+10
| | | | | | | | | | Add implementation for requestInterruption() and isInterruptionRequested(). Pick-to: 6.4 Change-Id: I9ffabb0181a48c71deded7362c6c8e2e96418cc0 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QThread: Clean up bindingStatusOrList if object gets deletedFabian Kosmale2022-07-141-0/+22
| | | | | | | | | | | | Deal with the case that the object gets deleted between a call to moveToThread and the start of the thread by removing the object from the list in that case. Fixes: QTBUG-104014 Pick-to: 6.4 Change-Id: Ib249b6e8e8dfbc4d1332bb99a57fa9d3cff16465 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QThread: Initialize bindingStatus for adopted threadsFabian Kosmale2022-07-131-1/+2
| | | | | | | | | | | | | If we create a QThread from QThread::current(), we want it to have a correct value for its bindingStatus. Thus, initialize bindingStatus in the ctor of QAdoptedThread. Task-number: QTBUG-101177 Task-number: QTBUG-102403 Pick-to: 6.4 6.3 Change-Id: I3ef27ed62c5dc25eed05d551c72743a1b8528318 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QPostEventList: de-inline addEvent()Marc Mutz2022-06-221-0/+23
| | | | | | | | | | | While in a private header, it did manage to place QList<QPostEvent> operations near the top spots of all Qt template instantiations in a QtWidgets build. Task-number: QTBUG-97601 Pick-to: 6.4 Change-Id: I4fa1972b8764b71ad0559633131e7e44b3d4ae6a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Optimize QThreadPrivate::addObjectWithPendingBindingStatusChange()Marc Mutz2022-05-261-3/+5
| | | | | | | | | | | | | | | | | | | | | ... and bindingStatus() QBindingStatus* is the final state of the value chain in m_statusOrPendingObjects, so we can use the Double-Checked Locking Pattern to avoid locking the mutex when we already have a status - it won't go away again, unlike the vector in the List state. To enable the change, make the data member an atomic<>. All loads and stores can continue to use memory_order::relaxed, except the loads of a potential status, which have to acquire, and the store of the status, which has to release. This creates the necessary synchronizes-with relation. So even though we synchronize out of middle of the mutex critical section in QThread::exec() this way, there's no data race between QThread::exec() and a potential bindingStatus() call. Change-Id: I0e0b7bd305649fa5f56a0f8723fb75f2577b90dd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix race conditions in moveToThreadFabian Kosmale2022-05-241-8/+52
| | | | | | | | | | | | | Amends ba6c1d2785ca6d8a8b162abcd9d978ab0c52ea2d, which made m_statusOrPendingObjects already atomic, but did not handle concurrent deletion/push_back of the pendingObjects vector correctly. We use the existing lock in QThreadPrivate to prevent data races. Pick-to: 6.2 6.3 Fixes: QTBUG-101681 Change-Id: I0b440fee6ec270d762e6700a4fe74f28b19e75e8 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-39/+3
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Doc: QThread: clarify that start() always creates the event dispatcherThiago Macieira2022-03-311-2/+5
| | | | | | | | Fixes: QTBUG-101283 Pick-to: 6.2 6.3 Change-Id: Ibf4acec0f166495998f7fffd16d6e4692be24409 Reviewed-by: Keith Kyzivat <keith.kyzivat@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Apply Q_CONSTINIT across the codebaseMarc Mutz2022-03-291-2/+2
| | | | | | | | | Still not complete. Just grepping for static and thread_local. Task-number: QTBUG-100486 Change-Id: I90ca14e8db3a95590ecde5f89924cf6fcc9755a3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QProperty: fix threading issuesFabian Kosmale2022-03-101-0/+10
| | | | | | | | | | | | | | | | | | | | QObject's cache the binding status pointer to avoid TLS lookups. However, when an object is moved to a different thread, we need to update the cached pointer (as the original thread might stop and thus no longer exist, and to correctly allow setting up bindings in the object's thread). Fix this by also storing the binding status in QThreadPrivate and updating the object's binding status when moved. This does only work when the thread is already running, though. If it is not running, we instead treat the QThreadPrivate's status pointer as a pointer to a vector of pending objects. Once the QThread has been started, we check if there are pending objects, and update them at this point. Pick-to: 6.2 6.3 Fixes: QTBUG-101177 Change-Id: I0490bbbdc1a17cb5f85044ad6eb2e1a8c759d4b7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QThread::idealThreadCount: use the thread affinity setThiago Macieira2021-12-161-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of returning the total number of logical processors in the system, which we may not be allowed to wholly run on, use the affinity set that the calling thread is allowed to use. Implemented for Linux and FreeBSD only, with up to 4x the number of processors than CPU_SETSIZE has as default (that would be 4096 logical processors on Linux, 1024 on FreeBSD). Implementation for Windows is possible, but the API there is always limited to 64, so I'm unsure if it is correct. Darwin (macOS) does not have this capability. Testing: $ ./tst_qthread idealThreadCount | grep QDEBUG QDEBUG : tst_QThread::idealThreadCount() Ideal thread count: 8 $ taskset 3 ./tst_qthread idealThreadCount | grep QDEBUG QDEBUG : tst_QThread::idealThreadCount() Ideal thread count: 2 [ChangeLog][QtCore][QThread] idealThreadCount() will now return the number of logical processors that the current process (thread) has assigned in its affinity set, instead of the total number of processors in the system. These two numbers can be different if the process is launched by the parent with a different affinity set, with tools like Linux's taskset(1) or schedtool(1). This is currently implemented for Linux and FreeBSD. Change-Id: I2cffe62afda945079b63fffd16bd086f64f5f314 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QThread::create(): request interruption and join on destructionGiuseppe D'Angelo2021-12-071-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If one destroys a running QThread, so far the behavior has been to crash (à la std::thread) -- assuming the thread hasn't already signalled that it has finished. This behavior is hostile to solutions such as using QThread::create(), which always require a wait() before destroying the thread object. We can use the opportunity to change the behavior without breaking any valid code. Instead of crashing, inside QThread's destructor we can ask the new thread to quit, and then join it (à la std::jthread). This simplifies the implementation of long-living runnables and the code that manages them. Deploying this solution for the whole QThread class may not be entirely painless. While no correct code would work differently with the proposed changes, incorrect code that deletes a running thread would no longer crash "loudly" -- instead, it might deadlock "quietly", have memory corruptions, etc. Hence I'm limiting this approach to only the threads created by QThread::create(), at least for the time being. This also side-steps perhaps the biggest problem of generalizing the approach, which is that placing such interrupt+join logic into~QThread's destructor would cause it to be run _after_ a QThread subclass' own destructor has run, destroying the subclass' data members too early. This might create an antipattern if one chooses to subclass QThread. With create(), a subclass in question exists, and it indeed has NSDMs, but it's entirely under our control (in fact, I'm placing the logic just in its dtor). [ChangeLog][QtCore][QThread] Destroying a QThread object created by QThread::create() while the thread that it manages is still running will now automatically ask that thread to quit, and will wait until the thread has finished. Before, this resulted in a program crash. See the documentation of QThread::~QThread() for more details. Change-Id: Ib268b13da422e277ee3ed6f6c7b2ecc8cea5750c Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QThread::wait: Clarify documentation for unsigned long overloadFabian Kosmale2021-11-271-0/+3
| | | | | | | | | | It is not immediately clear from the signature that the time parameter's unit is miliseconds. Pick-to: 6.2 Change-Id: Ifee3c6410b6b2352e75571cc53578a660aabb32d Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* corelib: Fix typos in documentationJonas Kvinge2021-10-121-1/+1
| | | | | | Pick-to: 5.15 6.2 Change-Id: I64d63af708bc6ddaabd12450eb3089e5077f849e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Call QEventDispatcher::startingUp() on thread startMorten Johan Sørvig2020-12-211-1/+0
| | | | | | | | | | | | | | | | ...instead of during createEventDispatcher(). This way, startingUp() will be called [on the thread being started] also for custom event dispatchers installed with QThread::setEventDispatcher(). This prevents crashes when installing event dispatches which expects that startingUp() will be called. Crash reproducible with test case from QTBUG-51961. Change-Id: I71bd696539689d928a61ff9b47d05297cf803b2f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Rename remaining QEvent variables to m_ convention; init m_reservedShawn Rutledge2020-11-101-1/+1
| | | | | Change-Id: I08694657b7c9d2713d0cb33519698dbba3bfdffa Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Resolve corelib's remaining ### Qt 6 commentsEdward Welbourne2020-11-021-2/+0
| | | | | | | | | | | | | No action taken at Qt 6, suggesting it shall never happen. Four removed, one converted to Qt 7, others converted to unversioned TODOs. Filed Jira tasks, and referenced in comments, for those retained. There remain two "once bootstrap builds are obsolete" comments and one other on which pending action may yet happen. Fixes: QTBUG-85700 Change-Id: Ib140a6a21c63370e51e4734cc591f67573a29d9a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Whitespace cleanup in corelib/ mimetypes, plugin and threadAllan Sandfeld Jensen2020-10-211-1/+1
| | | | | | | Done with selective application of clang-format Change-Id: Iee6bf2426de81356b6d480629ba972f980b6d93d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Another round of replacing 0 with nullptrAllan Sandfeld Jensen2020-10-071-1/+1
| | | | | | | | | This time based on grepping to also include documentation, tests and examples previously missed by the automatic tool. Change-Id: Ied1703f4bcc470fbc275f759ed5b7c588a5c4e9f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Inline one method as per ###Qt6Lars Knoll2020-09-121-6/+0
| | | | | | Change-Id: I4bf0ddf4ddf4044a60d881a57ef63b96d4bac262 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Doc: Improve thread safety docsPaul Wicking2020-08-201-1/+15
| | | | | | | | | | | | * Add missing \threadsafe command. * Add missing note for methods callable only from the started thread. * Expand note on excerting care when interacting with objects across threads in QThread's class overview documentation. Fixes: QTBUG-86112 Pick-to: 5.15 Change-Id: I8f181d92ad6196ff0c13f5a866a36793209a75ab Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QThread::create: remove the pre-C++17 codepathsGiuseppe D'Angelo2020-07-071-23/+0
| | | | | | | | | | | As we require C++17 now. The configure-time test checking for future/async is left in for the moment being. Change-Id: Ifde39d420673f70a2277f5a645bfaad30935a381 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QThread: Fix unnecessary stricter accesses to QThreadData::threadThiago Macieira2020-06-251-6/+6
| | | | | | | | | Commit ec6556a2b99df373eb43ca009340a7f0f19bacbd changed the member from a plain pointer to a QAtomicPointer. Not all accesses were caught. Pick-to: 5.15 Change-Id: I3d4f433ff6e94fd390a9fffd161b4ff25508c48d Reviewed-by: David Faure <david.faure@kdab.com>
* Remove winrtOliver Wolff2020-06-061-2/+0
| | | | | | | | | Macros and the await helper function from qfunctions_winrt(_p).h are needed in other Qt modules which use UWP APIs on desktop windows. Task-number: QTBUG-84434 Change-Id: Ice09c11436ad151c17bdccd2c7defadd08c13925 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-04-081-0/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/opengl/doc/src/cube.qdoc src/corelib/global/qlibraryinfo.cpp src/corelib/text/qbytearray_p.h src/corelib/text/qlocale_data_p.h src/corelib/time/qhijricalendar_data_p.h src/corelib/time/qjalalicalendar_data_p.h src/corelib/time/qromancalendar_data_p.h src/network/ssl/qsslcertificate.h src/widgets/doc/src/graphicsview.qdoc src/widgets/widgets/qcombobox.cpp src/widgets/widgets/qcombobox.h tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro tests/manual/diaglib/debugproxystyle.cpp tests/manual/diaglib/qwidgetdump.cpp tests/manual/diaglib/qwindowdump.cpp tests/manual/diaglib/textdump.cpp util/locale_database/cldr2qlocalexml.py util/locale_database/qlocalexml.py util/locale_database/qlocalexml2cpp.py Resolution of util/locale_database/ are based on: https://codereview.qt-project.org/c/qt/qtbase/+/294250 and src/corelib/{text,time}/*_data_p.h were then regenerated by running those scripts. Updated CMakeLists.txt in each of tests/auto/corelib/serialization/qcborstreamreader/ tests/auto/corelib/serialization/qcborvalue/ tests/auto/gui/kernel/ and generated new ones in each of tests/auto/gui/kernel/qaddpostroutine/ tests/auto/gui/kernel/qhighdpiscaling/ tests/libfuzzer/corelib/text/qregularexpression/optimize/ tests/libfuzzer/gui/painting/qcolorspace/fromiccprofile/ tests/libfuzzer/gui/text/qtextdocument/sethtml/ tests/libfuzzer/gui/text/qtextdocument/setmarkdown/ tests/libfuzzer/gui/text/qtextlayout/beginlayout/ by running util/cmake/pro2cmake.py on their changed .pro files. Changed target name in tests/auto/gui/kernel/qaction/qaction.pro tests/auto/gui/kernel/qaction/qactiongroup.pro tests/auto/gui/kernel/qshortcut/qshortcut.pro to ensure unique target names for CMake Changed tst_QComboBox::currentIndex to not test the currentIndexChanged(QString), as that one does not exist in Qt 6 anymore. Change-Id: I9a85705484855ae1dc874a81f49d27a50b0dcff7
| * No-thread: Don’t assert in ~QThreadData()Morten Johan Sørvig2020-04-031-0/+2
| | | | | | | | | | | | | | | | The no-thread build is not maintaining the QThreadData refcount. Change-Id: I80ce4151b8da9391764ed3d820943dcac0d70999 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-01-281-1/+5
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-271-1/+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>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-12-091-3/+3
|\| | | | | | | Change-Id: Ia24cc8b86def0d9d9c17d6775cc519e491b860b1
| * Tidy nullptr usageAllan Sandfeld Jensen2019-12-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | 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-251-7/+23
|\| | | | | | | | | | | | | | | | | | | 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-131-7/+23
| | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-11-011-0/+10
|\| | | | | | | Change-Id: I68a6ed3184e62fa89c47c564bb01002c0918d0fd
| * 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-201-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | 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>