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
8auto anotherFunction = []() {};
9auto mapFunction = [](int &value) { value *= 2; };
10QList<int> list = {1, 2, 3, 4, 5};
11
12//! [0]
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]
QList< int > list
[14]
void someFunction()
[10]