diff options
author | Andrei Golubev <andrei.golubev@qt.io> | 2020-10-14 11:57:59 +0200 |
---|---|---|
committer | Andrei Golubev <andrei.golubev@qt.io> | 2020-10-16 09:48:10 +0200 |
commit | 7332d3937dbad3b0995eb38d6e06cc0220a1d2d0 (patch) | |
tree | 0a7c2fac585f2a072312c08e0aae333527b5e325 /tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp | |
parent | 3ca600bd2d02a6950938789cef96229b15ec0cfa (diff) |
Rename QPromise starting and finishing methods to start and finish
Proposed during API review
Change-Id: I9c43e1915c50803ab69bfe07a91c05d2224b86c4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Diffstat (limited to 'tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp')
-rw-r--r-- | tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp b/tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp index 7180baccca..65a0921616 100644 --- a/tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp +++ b/tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp @@ -76,13 +76,13 @@ void snippet_QPromise::basicExample() QFuture<int> future = promise.future(); QScopedPointer<QThread> thread(QThread::create([] (QPromise<int> promise) { - promise.reportStarted(); // notifies QFuture that the computation is started + promise.start(); // notifies QFuture that the computation is started promise.addResult(42); - promise.reportFinished(); // notifies QFuture that the computation is finished + promise.finish(); // notifies QFuture that the computation is finished }, std::move(promise))); thread->start(); - future.waitForFinished(); // blocks until QPromise::reportFinished is called + future.waitForFinished(); // blocks until QPromise::finish is called future.result(); // returns 42 //! [basic] @@ -99,7 +99,7 @@ void snippet_QPromise::multithreadExample() // ... //! [multithread_init] - sharedPromise->reportStarted(); + sharedPromise->start(); //! [multithread_main] // here, QPromise is shared between threads via a smart pointer @@ -132,7 +132,7 @@ void snippet_QPromise::multithreadExample() for (auto& t : threads) t->wait(); - sharedPromise->reportFinished(); + sharedPromise->finish(); } void snippet_QPromise::suspendExample() @@ -142,7 +142,7 @@ void snippet_QPromise::suspendExample() QPromise<int> promise; QFuture<int> future = promise.future(); - promise.reportStarted(); + promise.start(); // Start a computation thread that supports suspension and cancellation QScopedPointer<QThread> thread(QThread::create([] (QPromise<int> promise) { for (int i = 0; i < 100; ++i) { @@ -151,7 +151,7 @@ void snippet_QPromise::suspendExample() if (promise.isCanceled()) // support cancellation break; } - promise.reportFinished(); + promise.finish(); }, std::move(promise))); thread->start(); //! [suspend_start] |