summaryrefslogtreecommitdiffstats
path: root/async/src/async.h
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-01-19 03:10:09 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-01-19 03:10:09 +0100
commit58385e4a48ff85fa847b4264d3f5216f62af24c1 (patch)
treeaa1624281830acfc4b6aa14d6e61ed16b2f50450 /async/src/async.h
parentd417f01e2eebeedfaae76b40667372bd0fb21fea (diff)
downloadsink-58385e4a48ff85fa847b4264d3f5216f62af24c1.tar.gz
sink-58385e4a48ff85fa847b4264d3f5216f62af24c1.zip
Fixed Async::Future.
The future is copied an the finished boolean has to be in the shared part, otherwise the original copy never receives the updated value.
Diffstat (limited to 'async/src/async.h')
-rw-r--r--async/src/async.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/async/src/async.h b/async/src/async.h
index 171a245..8fee0bc 100644
--- a/async/src/async.h
+++ b/async/src/async.h
@@ -300,8 +300,7 @@ void Executor<PrevOut, Out, In ...>::exec()
300 auto futureWatcher = new Async::FutureWatcher<PrevOut>(); 300 auto futureWatcher = new Async::FutureWatcher<PrevOut>();
301 QObject::connect(futureWatcher, &Async::FutureWatcher<PrevOut>::futureReady, 301 QObject::connect(futureWatcher, &Async::FutureWatcher<PrevOut>::futureReady,
302 [futureWatcher, this]() { 302 [futureWatcher, this]() {
303 //FIXME mFinished is not part of the d-pointer but we copy the future below 303 assert(futureWatcher->future().isFinished());
304 // assert(futureWatcher->future().isFinished());
305 futureWatcher->deleteLater(); 304 futureWatcher->deleteLater();
306 previousFutureReady(); 305 previousFutureReady();
307 }); 306 });
@@ -320,7 +319,7 @@ template<typename Out, typename ... In>
320void ThenExecutor<Out, In ...>::previousFutureReady() 319void ThenExecutor<Out, In ...>::previousFutureReady()
321{ 320{
322 if (this->mPrevFuture) { 321 if (this->mPrevFuture) {
323 assert(this->mPrevFuture->isFinished()); 322 assert(this->mPrevFuture->isFinished());
324 } 323 }
325 this->mFunc(this->mPrevFuture ? this->mPrevFuture->value() : In() ..., 324 this->mFunc(this->mPrevFuture ? this->mPrevFuture->value() : In() ...,
326 *static_cast<Async::Future<Out>*>(this->mResult)); 325 *static_cast<Async::Future<Out>*>(this->mResult));