/*
- * Copyright 2016 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/fibers/traits.h>
#include <folly/Try.h>
+#include <folly/fibers/traits.h>
namespace folly {
namespace fibers {
class Baton;
-template <typename T>
+template <typename T, typename BatonT = Baton>
class Promise {
public:
typedef T value_type;
+ typedef BatonT baton_type;
~Promise();
static value_type await(F&& func);
private:
- Promise(folly::Try<T>& value, Baton& baton);
+ Promise(folly::Try<T>& value, BatonT& baton);
folly::Try<T>* value_;
- Baton* baton_;
+ BatonT* baton_;
void throwIfFulfilled() const;
std::is_same<T, void>::value>::type
fulfilHelper(F&& func);
};
-}
-}
+} // namespace fibers
+} // namespace folly
#include <folly/fibers/Promise-inl.h>