make wait() and friends return reference to self instead of new Future
authorHans Fugal <fugalh@fb.com>
Fri, 6 Feb 2015 00:20:51 +0000 (16:20 -0800)
committerSara Golemon <sgolemon@fb.com>
Wed, 11 Feb 2015 02:01:59 +0000 (18:01 -0800)
commit2aa1ef48260d62982e1f27e265df240e5e8e154b
tree8da0f5f6f0c0ebd0a04d20ea2aaf73a26ea7ff33
parent1474b1094e2fe882d0c4b3f792ce5a0f7408b871
make wait() and friends return reference to self instead of new Future

Summary:
we still make the new Future, but assign it to ourselves. this avoids the following buggy pattern that people might expect to work

```
auto f = ...
f.wait();

// Careful. f.value() was moved out into the new Future, so you may have lost something
someOperationOn(f.value());

// Nope. We already set a callback internally in wait()
f.then(...);
```

Test Plan: unit

Reviewed By: davejwatson@fb.com

Subscribers: exa, yfeldblum, trunkagent, fbcode-common-diffs@, sammerat, cold-storage-diffs@, folly-diffs@, jsedgwick, aflock

FB internal diff: D1809040

Tasks: 6048284

Signature: t1:1809040:1422900812:1b416408eb5eaa71e88778c9c22ed8bfba087efe
folly/futures/Future-inl.h
folly/futures/Future.h
folly/futures/test/FutureTest.cpp