Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
src_corelib_thread_qfuturesynchronizer.cpp
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4
#
include
<
QFutureSynchronizer
>
5
#
include
<
QtConcurrent
>
6
#
include
<
QList
>
7
8
auto
anotherFunction
= []() {};
9
auto
mapFunction
= [](
int
&value) { value *= 2; };
10
QList
<
int
>
list
= {1, 2, 3, 4, 5};
11
12
//! [0]
13
void
someFunction
()
14
{
15
QFutureSynchronizer<
void
> synchronizer;
16
17
//...
18
19
synchronizer.addFuture(QtConcurrent::run(anotherFunction));
20
synchronizer.addFuture(QtConcurrent::map(list, mapFunction));
21
22
return
;
// QFutureSynchronizer waits for all futures to finish
23
}
24
//! [0]
list
QList< int > list
[14]
Definition
src_concurrent_qtconcurrentfilter.cpp:140
someFunction
void someFunction()
[10]
Definition
src_corelib_kernel_qmetatype.cpp:111
anotherFunction
auto anotherFunction
Definition
src_corelib_thread_qfuturesynchronizer.cpp:8
mapFunction
auto mapFunction
Definition
src_corelib_thread_qfuturesynchronizer.cpp:9
qtbase
src
corelib
doc
snippets
code
src_corelib_thread_qfuturesynchronizer.cpp
Generated on
for Qt by
1.14.0