summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp')
-rw-r--r--tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp b/tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp
index 2975afca0f..7180baccca 100644
--- a/tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp
+++ b/tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp
@@ -75,11 +75,8 @@ void snippet_QPromise::basicExample()
QPromise<int> promise;
QFuture<int> future = promise.future();
- // Note: calling reportStarted() prior to thread creation to enforce order
- // of calls: first promise.reportStarted() then future.waitForFinished()
- promise.reportStarted(); // notifies QFuture that the computation is started
-
QScopedPointer<QThread> thread(QThread::create([] (QPromise<int> promise) {
+ promise.reportStarted(); // notifies QFuture that the computation is started
promise.addResult(42);
promise.reportFinished(); // notifies QFuture that the computation is finished
}, std::move(promise)));