summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/snippets/code/src_corelib_thread_qfuturesynchronizer.cpp
blob: 0ea226fe0667800307b11007a4c3001b14558a8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

//! [0]
void someFunction()
{
    QFutureSynchronizer<void> synchronizer;

    ...

    synchronizer.addFuture(QtConcurrent::run(anotherFunction));
    synchronizer.addFuture(QtConcurrent::map(list, mapFunction));

    return; // QFutureSynchronizer waits for all futures to finish
}
//! [0]