summaryrefslogtreecommitdiffstats
path: root/src/concurrent
Commit message (Collapse)AuthorAgeFilesLines
* Update landing pages and module pages in qtbaseJerome Pasion2020-11-172-28/+29
| | | | | | | | | | -Qt SQL, Qt D-BUS, Qt GUI, Qt OpenGL, Qt Widgets, Qt Test, Qt Concurrent, Qt XML, Qt Network, Qt Core -language edits for consistency, add links Task-number: QTBUG-87155 Change-Id: Ic61350c9fa15090c802a42d8e9116219591eba73 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Don't highlight the QtConcurrent progress dialog exampleSona Kurazyan2020-11-121-2/+1
| | | | | Change-Id: Iaccfc5b8d30f6903c5d27b5ed379d1ca364f7c69 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Improve QtConcurrent ImageScaling example to demo new featuresSona Kurazyan2020-11-121-1/+2
| | | | | | | | | | | | | In order to demonstrate the new functionality, changed the example to download the images from the network, scale and show them by attaching different continuations to QFuture. Because QtConcurrent::map is not used anymore, removed the suspension functionality (supporting suspension of download would complicate the logic). Task-number: QTBUG-87205 Change-Id: I5a48b63195d28025ae8c5de28bc6d6178dad03db Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Reorder IterateKernel data members to avoid holes in the dataSona Kurazyan2020-11-091-6/+7
| | | | | Change-Id: I7661eaa6b14b7a7b930390e6bb8c6894f4a91846 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Automatically generate unit tests for QtConcurrentAndreas Buhr2020-11-091-1/+1
| | | | | | | | | | There are many different ways to to call map and filter functions in QtConcurrent. This patch adds a python script to generate all possible combinations. Change-Id: I61ed1758601e219c5852e8cc939c5feebb23d2f6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Rename "Porting" pages to "Changes"Jerome Pasion2020-11-092-3/+3
| | | | | | | | | | | | | | The content in the porting guides are closer to a changelog than a porting guide. At this point, it is easier for maintainers and contributors to write in a changelog than a guide. This change should help with readability and is closer to the usage of "Changes" in documentation. Part of a rename in other submodules. Task-number: QTBUG-87156 Change-Id: Ib59de7976fae19e7b39962e80161df6628e4070b Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix typos in QtConcurrent documentationVolker Hilsheimer2020-11-081-2/+2
| | | | | | | Correct misplaced r-value references. Change-Id: I3aa641a4e055b2f907bd5c05cfccf2933c74d5bc Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Use variadic templates to generalize MapSequenceResultTypeLars Knoll2020-11-031-3/+3
| | | | | | | | | | | This helps us determine the correct result type for std::vector, as that one has two template arguments and would otherwise not get caught here. Change-Id: Ie887088bce25df2cadc8422a4212dc33d57ecfa5 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Doc: Prefer versioned CMake library targetsv6.0.0-beta3Kai Koehne2020-11-011-1/+1
| | | | | | | | The non-versioned one's do miss some properties. It's therefore best to not advocate using them. Change-Id: I53645e65ed4de4e0100e59905c024cdfe40be0c5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Don't use pointers or references to functions from std libraryJarek Kobus2020-10-301-7/+11
| | | | | | Task-number: QTBUG-87719 Change-Id: I7331b7a0095fd41261173d309215f897542669ed Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Use universal references for passing callables in QtConcurrentSona Kurazyan2020-10-307-543/+682
| | | | | | | | Task-number: QTBUG-87596 Change-Id: I219f08d73b97317820ec6e329ab1e6c89c0545f1 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Doc: Fix links to the CMake manualTopi Reinio2020-10-301-1/+1
| | | | | | Task-number: QTBUG-86295 Change-Id: I7b2208284d65ec9182352490bd4c92458c5e5e37 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Move porting guide for QtConcurrent to its designated pageSona Kurazyan2020-10-291-1/+31
| | | | | | | | | Also move the porting section for QFuture and related classes after the section for view classes, to make the order more natural for reading. Change-Id: I5ea816d7bb3dfdda2b74112418bf07954c9ec94c Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QtConcurrent: Handle running with promise inside QTaskBuilderJarek Kobus2020-10-283-2/+20
| | | | | | | | | | | Please note, that in case of run with promise it doesn't make sense to provide the overload taking the FutureResult, as if we are going to ignore the returned QFuture object, we can't communicate with the passed QPromise. Fixes: QTBUG-87083 Change-Id: I4066506736c2bbeea3e42030b9495f13e06cb27e Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* QtConcurrent: Integrate runWithPromise into runJarek Kobus2020-10-285-147/+153
| | | | | | Change-Id: I6eb95aa66ff847e8bb9aac348fded3a5d55015b6 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Compile fix on WindowsJarek Kobus2020-10-271-2/+2
| | | | | | Task-number: QTBUG-87719 Change-Id: I9dd12b4579b40ec9c91a5751e12d371ed6ff5ac4 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Store std::exception_ptr in QUnhandledExceptionSona Kurazyan2020-10-262-3/+3
| | | | | | | | | | | | | | | | For historical reasons Qt Concurrent reports QUnhandledException in case if an exception that is not derived from QException is thrown from a worker thread. Changing this behavior may not be a good idea, since the existing user code may rely on it. Changed QUnhandledException to wrap the std::exception_ptr to the actual exception, so that the users can obtain the information about the thrown exception if needed. [ChangeLog][QtCore][QUnhandledException] Improved QUnhandledException to store the std::exception_ptr to the actual exception thrown from a QtCocnurrent worker thread. Change-Id: I30e7c1d3e01aff6e1ed9938c421da0a888f12066 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QtConcurrent: Reuse ArgResolver from qfuture_impl.hJarek Kobus2020-10-261-100/+4
| | | | | | Task-number: QTBUG-83331 Change-Id: I572f68f6d3be4a50970d8d77d070f175be3ec785 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Simplify implementations of QtConcurrent::blocking* methodsSona Kurazyan2020-10-142-89/+70
| | | | | | | Call non-blocking methods from the blocking ones. Change-Id: Icf63637223533254b76826340334de35bca258b2 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Minor cleanups based on API reviewSona Kurazyan2020-10-142-7/+7
| | | | | | | | | - Be more more consistent when declaring type aliases. - Re-group include directives Change-Id: Ic521e9f7692e538cc98871bdeccd9644c9879089 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Loosen the requirements on the container passed to QtConcurrent::map*Sona Kurazyan2020-10-132-3/+3
| | | | | | | | | | | | Using std::begin() and std::end() forces the user to have const begin() and end() member functions being defined for the passed container. This is because std::declval<T>() returns rvalue which forces the compiler to select std::{begin, end}()(const Container &c) overloads and an test for a presence of const {begin, end}() methods. Change-Id: I9d96d9f73891ece53224f1741a1334500f7b35ad Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Make QtConcurrent docs more readableSona Kurazyan2020-10-123-6/+125
| | | | | | | | | | | | - Replaced 'auto' keyword in function signatures by the actual return type. - Fixed signatures to not include enable_if statements. Change-Id: I7292e8e506fd50d22974a86448fa4e85e8f08dfb Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Eliminate the extra copy in QtConcurrent's blocking methodsSona Kurazyan2020-10-122-32/+32
| | | | | | | | | Use QFuture::takeResult() instead of QFuture::result() for returning the resulting sequence from the blocking methods of QtConcurrent. Change-Id: I0b623ee1ad8bda6789f329dcd63a46acda924539 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove an unneeded includeSona Kurazyan2020-10-121-2/+0
| | | | | Change-Id: Iba171012955e475f51d6319a69d8cd351aa6131b Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Use universal references in QtConcurrentSona Kurazyan2020-09-308-186/+230
| | | | | | | | | | | | | | Changed QtConcurrent algorithms to take the passed sequences as universal references, where it makes sense. In addition to avoiding to create extra copies when passing rvalues, this change allows passing temporary container adaptors to QtConcurrent::map (e.g. see the example in the ticket and the new test-cases). Task-number: QTBUG-83170 Change-Id: Ia7c0833f4ec1d860294fa5214cd53934b65ff084 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Improve docs for QtConcurrent::{filter, blockingFilter}Sona Kurazyan2020-09-291-6/+18
| | | | | | Change-Id: Ibe3a038ad6853da1a6c9246b1157cd7ada4b9f32 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix QtConcurrent algorithms to work with temporary sequencesSona Kurazyan2020-09-283-26/+25
| | | | | | | | | | | | | | | | QtConcurrent algorithms are making an internal copy of the passed sequence, to make sure it won't be destroyed before the execution is finished. However, they were using iterators of the originally passed sequence. So, if the original sequence is deleted, QtConcurrent algorithms would use invalid iterators to a deleted sequence. This might work with Qt containers thanks to implicit-sharing, but with other containers will lead to unexpected results. Fixed them to work on the internal copy of the original sequence. Change-Id: I1d68692ed9746223c85f51bb05977bc1443b681d Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-09-231-3/+3
| | | | | | | | | | | Modify special case locations to use the new API as well. Clean up some stale .prev files that are not needed anymore. Clean up some project files that are not used anymore. Task-number: QTBUG-86815 Change-Id: I9947da921f98686023c6bb053dfcc101851276b5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix some qdoc warnings: QtConcurrent functors and exceptionsVolker Hilsheimer2020-09-222-18/+4
| | | | | Change-Id: I32e45c85cedb74a6dcbd99930910b730f1160fae Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Correct link errors qtbaseNico Vertriest2020-09-211-1/+1
| | | | | | Task-number: QTBUG-86295 Change-Id: I27f6bbdadffb08a8794520a14dfe0e2334979575 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Add links to Qt 6 changes files from module indexPaul Wicking2020-09-181-0/+4
| | | | | | Task-number: QTBUG-84051 Change-Id: Iac25df135c9d73a990b41243e08cd38ea78296a4 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Doc: Add porting guide documentsPaul Wicking2020-09-161-0/+46
| | | | | | | | Also add existing such docs to the new document group Task-number: QTBUG-84051 Change-Id: I76f033f0846e09943f249d2beeb1606869eef382 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Get rid of qtconcurrentexception.hLars Knoll2020-09-103-67/+0
| | | | | | | | It only contained two aliases that have been deprecated since 2012. Change-Id: I6f65aa5144aca2d8d99f8a6e586b805f685afad2 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Mention QPromise on QtConcurrent pageJarek Kobus2020-09-011-0/+4
| | | | | | | Change-Id: I82d3ddd4a9129694d6dedcc742165cb2af135527 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QtConcurrent: Add documentation for runWithPromise()Jarek Kobus2020-08-266-12/+250
| | | | | | Task-number: QTBUG-84702 Change-Id: Ic8233aeffbdbd1420bdbde7ad7d03f25cd438ea8 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix include in public headerKai Koehne2020-08-231-1/+1
| | | | | | | | We shouldn't rely on include path containing also /QtCore Task-number: QTBUG-82615 Change-Id: I0f98f6097865cc5aa2c2fc9a0fabf2c4513b7afe Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Fix the doc exampleJarek Kobus2020-08-191-1/+1
| | | | | | | | The intention is to return list containing two items, not just one. Change-Id: I96f3ce939f2ef6db6bdac5d9165bb7814ebfa91a Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* QtConcurrent: Introduce runWithPromise()Jarek Kobus2020-08-192-2/+226
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The differences to run() method: 1. The passed function should have additional argument QPromise<T> &, declared as a first argument. 2. The return value of the function must be void. Result reporting should be done through passed QPromise<T> &promise argument. 3. By default, runWithPromise() doesn't support functors with overloaded operator()(). In case of overloaded functors the user needs to explicitly specify the result type as a template parameter passed to runWithPromise, like: struct Functor { void operator()(QPromise<int> &) { } void operator()(QPromise<double> &) { } }; Functor f; runWithPromise<double>(f); // this will select the 2nd overload Task-number: QTBUG-84702 Change-Id: Ie40d466938d316fc46eb7690e6ae0ce1c6c6d649 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Another round of 0->nullptr cleanupAllan Sandfeld Jensen2020-07-311-3/+3
| | | | | Change-Id: Ic8db7dc252f8fea46eb5a4f334726d6c7f4645a6 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* QtConcurrent: Get rid of multi-inheritance inside RunFunctionTaskBaseJarek Kobus2020-07-141-12/+14
| | | | | | | | Use aggregation instead. Prepare for using QPromise instead of QFutureInterface. Task-number: QTBUG-84702 Change-Id: Ic88564dca8c83a178a281cb843032292210a6d25 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* QtConcurrent: Get rid of code repetition for RunFunctionTask::run()Jarek Kobus2020-07-132-34/+21
| | | | | | Change-Id: If270982e54d2b11be00c71b9d012af629d181dfe Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Use QList instead of QVector in qtbaseJarek Kobus2020-07-074-19/+18
| | | | | | | | Fixes all other QVector occurrences Task-number: QTBUG-84469 Change-Id: I5f9311298d341a9a3061a6a640539583d1618939 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Avoid use of Q_UNUSED by eliminating the parameter namesLars Schmertmann2020-07-031-4/+2
| | | | | | | | | This change only happens to files touched by the commit to add missing ; to Q_UNUSED. Task-number: QTBUG-82978 Change-Id: I10e6993a2bb3952cf9a262708b8573550e0dbe63 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Doc: Update docs with cmake package informationNico Vertriest2020-06-301-0/+1
| | | | | | Task-number: QTBUG-85179 Change-Id: I70dda9b906ecd0b8d8f4d88b0562af8e6c428143 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Use QList instead of QVector in QtConcurrentJarek Kobus2020-06-225-5/+5
| | | | | | | Task-number: QTBUG-84469 Change-Id: I99e41c1fef5459d7358b20a97a1dbefcd43bb4e5 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Reuse the non blocking implementation for blocking oneJarek Kobus2020-06-052-183/+193
| | | | | | | | | | | | | | | | | Replace the implementation of blockingMappedReduced(): after calling non-blocking version of mappedReduced() we are getting the future object, so we may call in sequence result(), which will block and return the result when the all tasks are done. The same is done with blockigMapped(), which calls blockingMappedReduced() with a custom reduce function. Looks like with this pattern we can reuse the non-blocking version for implementing blocking version of mapped / filtered methods. Task-number: QTBUG-83918 Change-Id: I7f240cfbd04834d551ff79d717b72194a26996d7 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Deprecate the pause-related APIs of QFuture* classesSona Kurazyan2020-06-042-8/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Deprecated the pause-related APIs of QFuture* classes and added alternatives having "suspend" in the name instead. With 2f15927f01ceef0aca490746302a5ea57ea9441c new isSuspended()/suspended() APIs have been added to QFuture* classes for checking if pause/suspension is still in progress or it already took effect. To keep the naming more consistent, renamed: - setPaused() -> setSuspended() - pause() -> suspend() - togglePaused() -> toggleSuspended() - QFutureWatcher::paused() -> QFutureWatcher::suspending() Note that QFuture*::isPaused() now corresponds to (isSuspending() || isSuspended()). [ChangeLog][Deprecation Notice] Deprecated pause-related APIs of QFuture and QFutureWatcher. Added alternatives having "suspend" in the name instead. Change-Id: Ibeb75017a118401d64d18b72fb95d78e28c4661c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Add a way of notifying QFutureWatcher when pause is in effectSona Kurazyan2020-05-292-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | Because setting QFutureInterface to paused state does not mean that the computations that are already in progress will stop immediately, it may be useful to get notified when pause actually takes effect. Introduced the QFutureWatcher::suspended() signal, to be emitted when there are no more computations in progress, and no more result ready or progress reporting signals will be emitted, i.e. when pause took effect. Added {QFuture, QFutureWatcher}::isSuspended() methods for checking if pause took effect. QtConcurrent will now to send QFutureCallOutEvent::Suspended event when the state is paused and there are no more active threads. [ChangeLog][QtCore][QFutureWatcher] Added a new QFutureWatcher::suspended() signal, to be emitted when pause took effect, meaning that there are no more computations in progress. Added {QFuture, QFutureWatcher}::isSuspended() methods for checking if pause took effect. Fixes: QTBUG-12152 Change-Id: I88f2ad24d800cd6293dec63977d45bd35f9a09f0 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Make threadCount a const member of ReduceKernelJarek Kobus2020-05-281-1/+2
| | | | | Change-Id: I8e75263d3e02a6e6a20520ebecfdb4e40b562bbf Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Pass the thread pool into ReduceKernelJarek Kobus2020-05-283-7/+7
| | | | | | | | | This was overlooked when enabling setting a custom thread pool for various concurrent methods. Fixes: QTBUG-53465 Change-Id: I189a7776fa02bbc3e995538cc154a7246ad1ad7a Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>