summaryrefslogtreecommitdiffstats
path: root/src/concurrent
Commit message (Collapse)AuthorAgeFilesLines
* QtConcurrent: use variable templates for compile-time checksSona Kurazyan2022-01-203-17/+10
| | | | | | | | | Noticed during the API review. Pick-to: 6.3 6.2 Task-number: QTBUG-99883 Change-Id: I19571343a0cf0609beae2422ef1f69f7a34eb9ac Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QtConcurrent::run crashes on program exitTianlu Shao2021-12-201-1/+7
| | | | | | | | | | | | When an application is about to be closed and all the destructors are called, if there isQtConcurrent::run on the way, it crashes as the internal threadpool pointer is nullptr. Fixes: QTBUG-98901 Pick-to: 6.2 6.3 Change-Id: Idd84d1518fc6a225263e6666a0f1de2ccef79c82 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Doc: Use find_package(Qt6 REQUIRED COMPONENTS ...) idiomKai Köhne2021-12-091-1/+1
| | | | | | | | | | Using REQUIRED as a prefix instead of suffix works better with OPTIONAL_COMPONENTS, and is also the order in the CMake manual. Task-number: QTBUG-98867 Pick-to: 6.2 Change-Id: I1ab68408b95d8edf06272a3b9fceccd8d8e597fc Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Doc: Enable qdoc warning count limitVenugopal Shivashankar2021-10-211-0/+3
| | | | | | | | This should restrict changes that introduce new warnings. Change-Id: I7e4b5d9d5d84b7c336509c380bc7e6d86e360f4a Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* concurrent: Fix typo in documentationJonas Kvinge2021-10-121-1/+1
| | | | | | Pick-to: 6.2 Change-Id: Ibe3715de704f420ba3796d19c9e78cd6204eb4e5 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* concurrent: Fix namespace typoJonas Kvinge2021-10-121-1/+1
| | | | | Change-Id: I7fed1f3965f97a4e1c4d096bc19f98572ea35c53 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove checks for features available in C++17Ievgenii Meshcheriakov2021-10-021-2/+0
| | | | | | | | | | This patch removes most of the checks that are made using C++20 __cpp_* macros for features available in C++17 and earlier. Library feature check macros (__cpp_lib_*) are unaffected. Change-Id: I557b2bd0d4ff09b13837555e9880eb28e0355f64 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix QtConcurrent::blockingMapped to work with non-template sequencesSona Kurazyan2021-09-081-1/+7
| | | | | | | | | | | | | | | The code for deducing the type of output sequence was assuming that the input sequence is always a template class and was trying to use the corresponding container type for the output sequence. Fixed the deduction code, to assume that the output sequence has the same type as the input sequence, when it's not a template class. Also added tests to verify that all QtConcurrent functions support non-template input sequences. Fixes: QTBUG-30617 Pick-to: 6.2 6.1 Change-Id: I486fe99f3207cfff5dcceb3712cc7de863067edb Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Doc: Remove unsupported customFiltersKai Köhne2021-09-031-4/+0
| | | | | | | | | | | customFilters defined in .qdocconf are not supported anymore by Qt Assistant since Qt 5.13. Therefore remove them from all .qdocconf files, also to avoid cargo-culting them to new help modules. Task-number: QTBUG-95987 Change-Id: I664391460637d2e859348da0338e1a4a3ee9f570 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QtConcurrent: fix examples of overloaded methods in docsSona Kurazyan2021-08-184-8/+18
| | | | | | | | | | | | Wrap the overloaded methods in qOverload(), to make the examples compile. Also remove the extra whitespaces when declaring nested templates. Pick-to: 6.1 6.2 Change-Id: If438caa6d705d9036dae45278fb26e080918da89 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QtConcurrent::run: support non default-constructible return typesSona Kurazyan2021-08-182-26/+11
| | | | | | | | | | | | | | The QtConcurrent::RunFunctionTask class keeps a variable to store the result of QtConcurrent::run when it becomes available, so that it can be reported afterwards. This requires the result type to be default-constructible. However there's no need in storing the result, it can be reported immediately after it becomes available. Pick-to: 6.1 6.2 Fixes: QTBUG-95214 Change-Id: I95f3dbff0ab41eaa81b104a8834b37d10a0d193a Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Update QtConcurrent docs and examples for reductor object usageSona Kurazyan2021-07-264-23/+11
| | | | | | | | | After 6ebe3d0f0806069f906522dfe9b81baa3f3478de users don't have to specify the result type when using functors for as a reductor. Task-number: QTBUG-88448 Change-Id: I065fed11c1a66833ba0aac3d18e7ff0545247be1 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QtConcurrent: Remove the redundant code for QStringListSona Kurazyan2021-07-262-8/+0
| | | | | | | | | QStringList is a typedef for QList<QString>, so it doesn't need special handling. Change-Id: Ib371f9fa49d9d45da7956287dd0f5b6c0224f439 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix QtConcurrent to properly work with functorsSona Kurazyan2021-07-213-71/+101
| | | | | | | | | | | | | | | QtConcurrent reduce functions were requiring to explicitly pass the the result type when passing functors as reductor. This was because of inability to deduce the result type from the functors. The result type of the QtConcurrent reduce functions should match with the type of the fist argument of the operator() when a functor is passed. Reused the ArgResolver type trait (already used for QFuture and QtConcurrent::run) to find out the result type in that case. Task-number: QTBUG-88448 Change-Id: Ief0eeee197df8cb9c30f3403d71978f36e4fb0f2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Migrate to autogenerated cpp exportsAlexey Edelev2021-06-252-14/+2
| | | | | | | | | Replace the hardcoded cpp exports with a generated one where it's applicable. Task-number: QTBUG-90492 Change-Id: Idc160b594987b2c765e75bd669aae851b4366282 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove the dead code for blocking methods from QtConcurrentSona Kurazyan2021-06-142-56/+0
| | | | | | | | | | | | | | After 79fd1cb2c631b6084bf10874205d27f5b53c907a the methods for running QtConcurrent algorithms in the blocking mode aren't used anymore. Since ThreadEngineBase and ThreadEngineStarter classes aren't meant to be used externally, it should be fine to remove startBlocking() methods now. Removed the unused code and adjusted the tests accordingly. Change-Id: Ifb13820ce207869d6f720bcb5be8d35bb355fe33 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* QtConcurrentIterateKernel: fix warningMårten Nordheim2021-04-121-1/+1
| | | | | | | | | src\concurrent\qtconcurrentiteratekernel.cpp(134): warning C5055: operator '*': deprecated between enumerations and floating-point types Pick-to: 6.0 6.1 Change-Id: I934e767e77e9393e1da3adc390dc8e252e7f5b6a Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Remove the unnecessary template parameter from the class specializationSona Kurazyan2021-03-171-2/+2
| | | | | | | | | | | | This seems to cause errors when compiling with gcc-11. Although this is most likely a compiler bug, specifiying the template parameter type in this case isn't necessary. Fixes: QTBUG-91909 Fixes: QTBUG-90568 Pick-to: 6.0 6.1 5.15 Change-Id: Ib231257ccb2e16cc533f23ca5840d31e26a66d53 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Improve docs for Qt Concurrent run with promise modeSona Kurazyan2021-03-041-0/+9
| | | | | | | | | | | | For the readers that are new to QtConcurrent, it may be confusing that unlike the normal usage of QPromise, they don't have to call start() or finish() when using Qt Concurrent run with promise mode. Be more explicit about that. Pick-to: 6.1 Change-Id: I08df6c4ca41bec4120e208a6643ee20c7adf265c Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Revert "Remove the qmake project files" for snippetsNico Vertriest2021-02-121-0/+3
| | | | | | | | | | | This reverts a limited part of commit ad2da2d27a590333fc89a56fc58700a09c3017b3 that deleted .pro files for snippets compilation. Some .pro files which contain snippets used in the documentation itself should be restored. Task-number: QTBUG-90483 Change-Id: I1b03833c8ff17b5fca43a5b6c5417e8545b1711b Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Remove the qmake project filesJoerg Bornemann2021-01-072-44/+0
| | | | | | | | | | | | | | | | Remove the qmake project files for most of Qt. Leave the qmake project files for examples, because we still test those in the CI to ensure qmake does not regress. Also leave the qmake project files for utils and other minor parts that lack CMake project files. Task-number: QTBUG-88742 Change-Id: I6cdf059e6204816f617f9624f3ea9822703f73cc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Document that QtConcurrent::run doesn't support overloaded functionsSona Kurazyan2020-12-233-0/+43
| | | | | | | | | | | | After improving QtConcurrent::run() to use parameter packs for the arguments (see c977e74afd18afff8729070f631e6b7a3f2887f5), calling overloaded functions is ambiguous. Updated the porting guide and the documentation to mention this and describe possible workarounds. Task-number: QTBUG-89648 Pick-to: 6.0 Change-Id: I4c1f996ae67bce8c13cc1f99f54240295db6ae1d Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Clean up qtconcurrent.qdocconf fileKai Koehne2020-12-101-2/+1
| | | | | | | | Remove unused parent directory for exampledirs. Also fix content of excludedirs. Change-Id: Iac15ec3eb12121c0384e36c31299034624257db4 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QtConcurrent: filter/map reduction without default ctorIvan Solovev2020-12-043-34/+99
| | | | | | | | | | | | | | | | | Previously a default constructor was required for the result type of mappedReduced() and filteredReduced(), even if a default value was provided. This patch fixes the problem. The issue was in the ResultReporter type, that was calling QList::resize() to adjust the size of expected reported results. A default-value parameter was added to the class, so that a corresponding overload of QList::resize could be invoked. Task-number: QTBUG-88452 Change-Id: I51113753e314d76aa74d201b5a7e327a6ca75f47 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Doc: Use explicit linkage with target_link_librariesKai Koehne2020-11-301-1/+1
| | | | | | | | | | | | | | The Professional CMake book suggests always using explicit linkage with target_link_libraries, so let's use that. Whether to use PUBLIC or PRIVATE depends on the context. But let's be conservative and advise on using PRIVATE by default. Task-number: QTBUG-88935 Pick-to: 6.0 Change-Id: I12b80ee85be9f6916f1e4dea6b1c9cb29e03c20f Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* 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>