• Hans Fugal's avatar
    (wangle) Interrupts (and therefore, cancellation) · 831405dc
    Hans Fugal authored
    Summary:
    Modeled very closely after Finagle's interrupts. Compare with https://github.com/twitter/util/blob/master/util-core/src/main/scala/com/twitter/util/Promise.scala if you like.
    The basic idea is the promise holder can register an interrupt handler, and then interrupts will call that handler. A typical handler would fulfil the promise with an exception (or special value) indicating that it was interrupted (if it was interrupted in time).
    Raising an interrupt does not prevent setting a value or callbacks executing or any of that - it is only advisory to the promise holder.
    
    Test Plan: I wrote some unit tests.
    
    Reviewed By: davejwatson@fb.com
    
    Subscribers: folly-diffs@, net-systems@, fugalh, exa, hannesr, njormrod
    
    FB internal diff: D1620805
    
    Tasks: 4618297
    831405dc
Future-inl.h 12.3 KB