summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Vrátil <dvratil@redhat.com>2015-02-07 17:45:18 +0100
committerDan Vrátil <dvratil@redhat.com>2015-02-07 17:45:18 +0100
commitda0bcaf6469311f03ba35d48a4a405c95594a686 (patch)
tree9b8ce8530e2e287db8020a9b338dd24bfd9b3322
parentb737a7deb5161d8b289c4c4bdfa324dccdb07dff (diff)
downloadsink-da0bcaf6469311f03ba35d48a4a405c95594a686.tar.gz
sink-da0bcaf6469311f03ba35d48a4a405c95594a686.zip
Async: mark our future as finished after returning from error handler
Error handlers don't have access to the future, so they can't mark it as finished, so we do it after the error handler is run. This ensures that FutureWatchers will finish.
-rw-r--r--async/src/async.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/async/src/async.h b/async/src/async.h
index a2a11ac..753a44f 100644
--- a/async/src/async.h
+++ b/async/src/async.h
@@ -342,6 +342,7 @@ void ThenExecutor<Out, In ...>::previousFutureReady()
342 if (this->mPrevFuture && this->mPrevFuture->errorCode()) { 342 if (this->mPrevFuture && this->mPrevFuture->errorCode()) {
343 if (this->mErrorFunc) { 343 if (this->mErrorFunc) {
344 this->mErrorFunc(this->mPrevFuture->errorCode(), this->mPrevFuture->errorMessage()); 344 this->mErrorFunc(this->mPrevFuture->errorCode(), this->mPrevFuture->errorMessage());
345 this->mResult->setFinished();
345 } else { 346 } else {
346 static_cast<Async::Future<Out>*>(this->mResult)->setError(this->mPrevFuture->errorCode(), this->mPrevFuture->errorMessage()); 347 static_cast<Async::Future<Out>*>(this->mResult)->setError(this->mPrevFuture->errorCode(), this->mPrevFuture->errorMessage());
347 //propagate error if no error handler is available 348 //propagate error if no error handler is available