• Hans Fugal's avatar
    make wait() and friends return reference to self instead of new Future · 2aa1ef48
    Hans Fugal authored
    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
    2aa1ef48
Future-inl.h 20 KB