Statically allocate futex array
[folly.git] / folly / fibers / Promise.h
index fde863dafdc9baa3f3e021bd297d4143aee8757e..c87faf9f78a8af1ca03d2a6c8e593c204fa93444 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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();
 
@@ -80,9 +81,9 @@ class 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;
 
@@ -98,7 +99,7 @@ class Promise {
       std::is_same<T, void>::value>::type
   fulfilHelper(F&& func);
 };
-}
-}
+} // namespace fibers
+} // namespace folly
 
 #include <folly/fibers/Promise-inl.h>