projects
/
folly.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix class member shadowing in folly::ProducerConsumerQueue
[folly.git]
/
folly
/
futures
/
SharedPromise-inl.h
diff --git
a/folly/futures/SharedPromise-inl.h
b/folly/futures/SharedPromise-inl.h
index c2f6d45428d35e4966e272c0e25ec839486373d4..185062acdbcc01afbc5fd19ee543dadcc06a4b06 100644
(file)
--- a/
folly/futures/SharedPromise-inl.h
+++ b/
folly/futures/SharedPromise-inl.h
@@
-1,5
+1,5
@@
/*
/*
- * Copyright 201
5
Facebook, Inc.
+ * Copyright 201
7
Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* 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<T>& SharedPromise<T>::operator=(
std::swap(size_, other.size_);
std::swap(hasValue_, other.hasValue_);
std::swap(try_, other.try_);
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;
std::swap(promises_, other.promises_);
return *this;
@@
-60,6
+61,9
@@
Future<T> SharedPromise<T>::getFuture() {
return makeFuture<T>(Try<T>(try_));
} else {
promises_.emplace_back();
return makeFuture<T>(Try<T>(try_));
} else {
promises_.emplace_back();
+ if (interruptHandler_) {
+ promises_.back().setInterruptHandler(interruptHandler_);
+ }
return promises_.back().getFuture();
}
}
return promises_.back().getFuture();
}
}
@@
-88,6
+92,7
@@
void SharedPromise<T>::setInterruptHandler(
if (hasValue_) {
return;
}
if (hasValue_) {
return;
}
+ interruptHandler_ = fn;
for (auto& p : promises_) {
p.setInterruptHandler(fn);
}
for (auto& p : promises_) {
p.setInterruptHandler(fn);
}
@@
-124,4
+129,9
@@
void SharedPromise<T>::setTry(Try<T>&& t) {
}
}
}
}
+template <class T>
+bool SharedPromise<T>::isFulfilled() {
+ return hasValue_;
+}
+
}
}