Add multithreading support

Make QPromise thread safe but also ensure that continuation lambdas (then/fail/finally) are called in the thread of the promise instance they are attached to.
This commit is contained in:
Simon Brunel
2017-06-04 18:22:24 +02:00
parent 2d9961de82
commit 81625e1964
7 changed files with 281 additions and 45 deletions

View File

@ -1,4 +1,3 @@
QT += concurrent
TARGET = tst_benchmark
SOURCES += $$PWD/tst_benchmark.cpp

View File

@ -2,7 +2,6 @@
#include <QtPromise>
// Qt
#include <QtConcurrent>
#include <QtTest>
using namespace QtPromise;
@ -11,11 +10,11 @@ class tst_benchmark: public QObject
{
Q_OBJECT
private Q_SLOTS:
void valueResolve();
void valueReject();
void valueThen();
void errorReject();
private Q_SLOTS:
void errorThen();
}; // class tst_benchmark