/*
- * Copyright 2015 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#pragma once
+#include <folly/Portability.h>
#include <folly/futures/Promise.h>
namespace folly {
*/
template <class T>
class SharedPromise {
-public:
+ public:
SharedPromise() = default;
~SharedPromise() = default;
p.setException(std::current_exception());
}
*/
- DEPRECATED void setException(std::exception_ptr const&);
+ FOLLY_DEPRECATED("use setException(exception_wrapper)")
+ void setException(std::exception_ptr const&);
/** Fulfill the SharedPromise with an exception type E, which can be passed to
std::make_exception_ptr(). Useful for originating exceptions. If you
template <class F>
void setWith(F&& func);
-private:
+ bool isFulfilled();
+
+ private:
std::mutex mutex_;
size_t size_{0};
bool hasValue_{false};
Try<T> try_;
std::vector<Promise<T>> promises_;
+ std::function<void(exception_wrapper const&)> interruptHandler_;
};
-}
+} // namespace folly
#include <folly/futures/Future.h>
#include <folly/futures/SharedPromise-inl.h>