diff options
| author | Sona Kurazyan <sona.kurazyan@qt.io> | 2020-10-13 15:18:08 +0200 |
|---|---|---|
| committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2020-10-14 21:24:31 +0200 |
| commit | 0599255fcf54086ae345d289e8f761d890a91a39 (patch) | |
| tree | e6bf5664c17cd2afa3da814ea3c7380261c18cb8 /src/concurrent/qtconcurrentmap.h | |
| parent | 9ded4739140e7e30aa386a9800c26afdbf952fd3 (diff) | |
Simplify implementations of QtConcurrent::blocking* methods
Call non-blocking methods from the blocking ones.
Change-Id: Icf63637223533254b76826340334de35bca258b2
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
Diffstat (limited to 'src/concurrent/qtconcurrentmap.h')
| -rw-r--r-- | src/concurrent/qtconcurrentmap.h | 92 |
1 files changed, 36 insertions, 56 deletions
diff --git a/src/concurrent/qtconcurrentmap.h b/src/concurrent/qtconcurrentmap.h index 29ab364e77d..e6a434f852b 100644 --- a/src/concurrent/qtconcurrentmap.h +++ b/src/concurrent/qtconcurrentmap.h @@ -435,9 +435,8 @@ ResultType blockingMappedReduced(QThreadPool *pool, ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) { - QFuture<ResultType> future = QtConcurrent::startMappedReduced - <QtPrivate::MapResultType<Sequence, MapFunctor>, ResultType> - (pool, std::forward<Sequence>(sequence), map, reduce, options); + QFuture<ResultType> future = + mappedReduced<ResultType>(pool, std::forward<Sequence>(sequence), map, reduce, options); return future.takeResult(); } @@ -448,9 +447,8 @@ ResultType blockingMappedReduced(Sequence &&sequence, ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) { - QFuture<ResultType> future = QtConcurrent::startMappedReduced - <QtPrivate::MapResultType<Sequence, MapFunctor>, ResultType> - (QThreadPool::globalInstance(), std::forward<Sequence>(sequence), map, reduce, options); + QFuture<ResultType> future = + mappedReduced<ResultType>(std::forward<Sequence>(sequence), map, reduce, options); return future.takeResult(); } @@ -470,10 +468,9 @@ ResultType blockingMappedReduced(QThreadPool *pool, ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) { - QFuture<ResultType> future = QtConcurrent::startMappedReduced - <QtPrivate::MapResultType<Sequence, MapFunctor>, ResultType> - (pool, std::forward<Sequence>(sequence), map, reduce, - ResultType(std::forward<InitialValueType>(initialValue)), options); + QFuture<ResultType> future = mappedReduced<ResultType>( + pool, std::forward<Sequence>(sequence), map, reduce, + ResultType(std::forward<InitialValueType>(initialValue)), options); return future.takeResult(); } @@ -492,10 +489,9 @@ ResultType blockingMappedReduced(Sequence &&sequence, ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) { - QFuture<ResultType> future = QtConcurrent::startMappedReduced - <QtPrivate::MapResultType<Sequence, MapFunctor>, ResultType> - (QThreadPool::globalInstance(), std::forward<Sequence>(sequence), map, reduce, - ResultType(std::forward<InitialValueType>(initialValue)), options); + QFuture<ResultType> future = mappedReduced<ResultType>( + std::forward<Sequence>(sequence), map, reduce, + ResultType(std::forward<InitialValueType>(initialValue)), options); return future.takeResult(); } @@ -508,9 +504,8 @@ ResultType blockingMappedReduced(QThreadPool *pool, ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) { - QFuture<ResultType> future = QtConcurrent::startMappedReduced - <QtPrivate::MapResultType<Sequence, MapFunctor>, ResultType> - (pool, std::forward<Sequence>(sequence), map, reduce, options); + QFuture<ResultType> future = + mappedReduced<ResultType>(pool, std::forward<Sequence>(sequence), map, reduce, options); return future.takeResult(); } @@ -522,9 +517,8 @@ ResultType blockingMappedReduced(Sequence &&sequence, ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) { - QFuture<ResultType> future = QtConcurrent::startMappedReduced - <QtPrivate::MapResultType<Sequence, MapFunctor>, ResultType> - (QThreadPool::globalInstance(), std::forward<Sequence>(sequence), map, reduce, options); + QFuture<ResultType> future = + mappedReduced<ResultType>(std::forward<Sequence>(sequence), map, reduce, options); return future.takeResult(); } @@ -545,10 +539,9 @@ ResultType blockingMappedReduced(QThreadPool *pool, ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) { - QFuture<ResultType> future = QtConcurrent::startMappedReduced - <QtPrivate::MapResultType<Sequence, MapFunctor>, ResultType> - (pool, std::forward<Sequence>(sequence), map, reduce, - ResultType(std::forward<InitialValueType>(initialValue)), options); + QFuture<ResultType> future = mappedReduced<ResultType>( + pool, std::forward<Sequence>(sequence), map, reduce, + ResultType(std::forward<InitialValueType>(initialValue)), options); return future.takeResult(); } @@ -568,10 +561,9 @@ ResultType blockingMappedReduced(Sequence &&sequence, ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) { - QFuture<ResultType> future = QtConcurrent::startMappedReduced - <QtPrivate::MapResultType<Sequence, MapFunctor>, ResultType> - (QThreadPool::globalInstance(), std::forward<Sequence>(sequence), map, reduce, - ResultType(std::forward<InitialValueType>(initialValue)), options); + QFuture<ResultType> future = mappedReduced<ResultType>( + std::forward<Sequence>(sequence), map, reduce, + ResultType(std::forward<InitialValueType>(initialValue)), options); return future.takeResult(); } @@ -585,9 +577,7 @@ ResultType blockingMappedReduced(QThreadPool *pool, ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) { - QFuture<ResultType> future = QtConcurrent::startMappedReduced - <QtPrivate::MapResultType<Iterator, MapFunctor>, ResultType> - (pool, begin, end, map, reduce, options); + QFuture<ResultType> future = mappedReduced<ResultType>(pool, begin, end, map, reduce, options); return future.takeResult(); } @@ -599,9 +589,7 @@ ResultType blockingMappedReduced(Iterator begin, ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) { - QFuture<ResultType> future = QtConcurrent::startMappedReduced - <QtPrivate::MapResultType<Iterator, MapFunctor>, ResultType> - (QThreadPool::globalInstance(), begin, end, map, reduce, options); + QFuture<ResultType> future = mappedReduced<ResultType>(begin, end, map, reduce, options); return future.takeResult(); } @@ -622,10 +610,9 @@ ResultType blockingMappedReduced(QThreadPool *pool, ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) { - QFuture<ResultType> future = QtConcurrent::startMappedReduced - <QtPrivate::MapResultType<Iterator, MapFunctor>, ResultType> - (pool, begin, end, map, reduce, ResultType(std::forward<InitialValueType>(initialValue)), - options); + QFuture<ResultType> future = mappedReduced<ResultType>( + pool, begin, end, map, reduce, ResultType(std::forward<InitialValueType>(initialValue)), + options); return future.takeResult(); } @@ -645,10 +632,9 @@ ResultType blockingMappedReduced(Iterator begin, ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) { - QFuture<ResultType> future = QtConcurrent::startMappedReduced - <QtPrivate::MapResultType<Iterator, MapFunctor>, ResultType> - (QThreadPool::globalInstance(), begin, end, map, reduce, - ResultType(std::forward<InitialValueType>(initialValue)), options); + QFuture<ResultType> future = mappedReduced<ResultType>( + begin, end, map, reduce, ResultType(std::forward<InitialValueType>(initialValue)), + options); return future.takeResult(); } @@ -662,9 +648,7 @@ ResultType blockingMappedReduced(QThreadPool *pool, ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) { - QFuture<ResultType> future = QtConcurrent::startMappedReduced - <QtPrivate::MapResultType<Iterator, MapFunctor>, ResultType> - (pool, begin, end, map, reduce, options); + QFuture<ResultType> future = mappedReduced<ResultType>(pool, begin, end, map, reduce, options); return future.takeResult(); } @@ -677,9 +661,7 @@ ResultType blockingMappedReduced(Iterator begin, ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) { - QFuture<ResultType> future = QtConcurrent::startMappedReduced - <QtPrivate::MapResultType<Iterator, MapFunctor>, ResultType> - (QThreadPool::globalInstance(), begin, end, map, reduce, options); + QFuture<ResultType> future = mappedReduced<ResultType>(begin, end, map, reduce, options); return future.takeResult(); } @@ -701,10 +683,9 @@ ResultType blockingMappedReduced(QThreadPool *pool, ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) { - QFuture<ResultType> future = QtConcurrent::startMappedReduced - <QtPrivate::MapResultType<Iterator, MapFunctor>, ResultType> - (pool, begin, end, map, reduce, ResultType(std::forward<InitialValueType>(initialValue)), - options); + QFuture<ResultType> future = mappedReduced<ResultType>( + pool, begin, end, map, reduce, ResultType(std::forward<InitialValueType>(initialValue)), + options); return future.takeResult(); } @@ -725,10 +706,9 @@ ResultType blockingMappedReduced(Iterator begin, ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce)) { - QFuture<ResultType> future = QtConcurrent::startMappedReduced - <QtPrivate::MapResultType<Iterator, MapFunctor>, ResultType> - (QThreadPool::globalInstance(), begin, end, map, reduce, - ResultType(std::forward<InitialValueType>(initialValue)), options); + QFuture<ResultType> future = mappedReduced<ResultType>( + begin, end, map, reduce, ResultType(std::forward<InitialValueType>(initialValue)), + options); return future.takeResult(); } |
