X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2Ffutures%2FSharedPromise-inl.h;h=90d0dd3d3758de9a45247813922268aad9869835;hb=914e877b032b402e31990f80dfef1bf489daf311;hp=76bd0caec266b316f5e6af90e8882a0a55909606;hpb=fc0470a93d86dec8fe9fa3db7bc05672cc8979b0;p=folly.git diff --git a/folly/futures/SharedPromise-inl.h b/folly/futures/SharedPromise-inl.h index 76bd0cae..90d0dd3d 100644 --- a/folly/futures/SharedPromise-inl.h +++ b/folly/futures/SharedPromise-inl.h @@ -1,5 +1,5 @@ /* - * Copyright 2015 Facebook, Inc. + * Copyright 2016 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,6 +41,7 @@ SharedPromise& SharedPromise::operator=( std::swap(size_, other.size_); std::swap(hasValue_, other.hasValue_); std::swap(try_, other.try_); + std::swap(interruptHandler_, other.interruptHandler_); std::swap(promises_, other.promises_); return *this; @@ -60,6 +61,9 @@ Future SharedPromise::getFuture() { return makeFuture(Try(try_)); } else { promises_.emplace_back(); + if (interruptHandler_) { + promises_.back().setInterruptHandler(interruptHandler_); + } return promises_.back().getFuture(); } } @@ -88,6 +92,7 @@ void SharedPromise::setInterruptHandler( if (hasValue_) { return; } + interruptHandler_ = fn; for (auto& p : promises_) { p.setInterruptHandler(fn); }