-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/17685/
-----------------------------------------------------------

Review request for mesos, Adam B, Ben Mahler, Ian Downes, Jie Yu, Niklas 
Nielsen, TILL TOENSHOFF, Vinod Kone, and Jiang Yan Xu.


Repository: mesos-git


Description
-------

Previously, invoking Future::discard caused a future to transition
into the DISCARDED state which meant that any callbacks associated wit
such a transition (i.e., Future::onAny, Future::onDiscarded) got
executed _even if the computation associated with the future had not
yet completed_! This meant certain patterns where difficult if not all
together impossible. Consider:
    
  ExpensiveResource* resource = new ExpensiveResource();
    
  Future<int> future = function()
    .then([=] () { ... *resource ...; })
    .onDiscarded([=] () { delete resource; });
    
  future.discard();
    
In the above code, it's possible that the onDiscarded lambda would
execute _concurrently_ with the lambda in the then! With the new
semantics, a discard is more advisorial: rather than transition a
future it instead allows a subsequent computation to decide whether or
not to cancel (or even begin) some computation. For example, the
Future::then implementation uses the "discard" information to decide
whether or not to execute the next lambda after the previous future
has been satisfied.
    
A few new helpers have been added to support this refactor:
    
  Future::onDiscard(callback):
    
    Adds a callback for when Future::discard was executed on this future.
    
  Future::hasDiscard():
    
    Checks to see if Future::discard was executed on this future.
    
  Promise::discard():
    
    Transitions this promises underlying future to DISCARDED.


Diffs
-----

  3rdparty/libprocess/3rdparty/stout/tests/os/signals_tests.cpp 
66caa0490189cb1aff3af1631fbcf7150658b6cc 
  3rdparty/libprocess/include/process/collect.hpp 
ff8ab341a588d26f9678aea7f53e892d292725ec 
  3rdparty/libprocess/include/process/future.hpp 
aaf17af2eef0f1bf7062aa04469f1fa27bb4cfbe 
  3rdparty/libprocess/include/process/protobuf.hpp 
7500601026a58c95325ffe4410a161d59ff7817e 
  3rdparty/libprocess/src/process.cpp 1083a35a0fef48d5f790ec49305a56fd7ef451d5 
  3rdparty/libprocess/src/tests/http_tests.cpp 
62ab64d81c11ab7260620c91100b7e1f29b81e33 
  3rdparty/libprocess/src/tests/io_tests.cpp 
ee5b0b4d22a4bfcac7140f87924964b8dfb50ac6 
  3rdparty/libprocess/src/tests/process_tests.cpp 
be288c353dce78ef641708646979e2e4f3f2c504 

Diff: https://reviews.apache.org/r/17685/diff/


Testing
-------

make check


Thanks,

Benjamin Hindman

Reply via email to