Commit ba208d71 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Tweak SharedPromise and FutureSplitter docs

Summary: [Folly] Tweak `SharedPromise` and `FutureSplitter` docs, in particular to reflection recent changes to execution semantics.

Reviewed By: LeeHowes

Differential Revision: D7630725

fbshipit-source-id: 68da70cd86d131aa09c1909d90a793868039e84f
parent f35c91c0
...@@ -23,13 +23,10 @@ namespace folly { ...@@ -23,13 +23,10 @@ namespace folly {
/* /*
* FutureSplitter provides a `getFuture()' method which can be called multiple * FutureSplitter provides a `getFuture()' method which can be called multiple
* times, returning a new Future each time. These futures are called-back when * times, returning a new Future each time. These futures are completed when the
* the original Future passed to the FutureSplitter constructor completes. Calls * original Future passed to the FutureSplitter constructor is completed, and
* to `getFuture()' after that time return a completed Future. * are completed on the same executor (if any) as the original Future. Calls to
* * `getFuture()' after that time return a completed Future.
* Note that while the Futures from `getFuture()' depend on the completion of
* the original Future they do not inherit any other properties such as
* Executors passed to `via' etc.
*/ */
template <class T> template <class T>
class FutureSplitter { class FutureSplitter {
......
...@@ -25,13 +25,16 @@ namespace folly { ...@@ -25,13 +25,16 @@ namespace folly {
/* /*
* SharedPromise provides the same interface as Promise, but you can extract * SharedPromise provides the same interface as Promise, but you can extract
* multiple Futures from it, i.e. you can call getFuture() as many times as * multiple Futures from it, i.e. you can call getFuture() as many times as
* you'd like. When the SharedPromise is fulfilled, all of the Futures will be * you'd like. When the SharedPromise is fulfilled, all of the Futures are
* called back. Calls to getFuture() after the SharedPromise is fulfilled return * completed. Calls to getFuture() after the SharedPromise is fulfilled return
* a completed Future. If you find yourself constructing collections of Promises * a completed Future. If you find yourself constructing collections of Promises
* and fulfilling them simultaneously with the same value, consider this * and fulfilling them simultaneously with the same value, consider this
* utility instead. Likewise, if you find yourself in need of setting multiple * utility instead. Likewise, if you find yourself in need of setting multiple
* callbacks on the same Future (which is indefinitely unsupported), consider * callbacks on the same Future (which is indefinitely unsupported), consider
* refactoring to use SharedPromise to "split" the Future. * refactoring to use SharedPromise to "split" the Future.
*
* The ShardPromise must be kept alive manually. Consider FutureSplitter for
* automatic lifetime management.
*/ */
template <class T> template <class T>
class SharedPromise { class SharedPromise {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment