Reverted commit D3979179
authorAlex Yarmula <ayarmula@fb.com>
Thu, 6 Oct 2016 15:51:33 +0000 (08:51 -0700)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Thu, 6 Oct 2016 15:53:46 +0000 (08:53 -0700)
commitb59ee6802a2454e854a52535d31598aa967e33c0
tree7a9038e072096a83486fa22b7d12b9ec254e15d1
parentd359ca6885fe5e0a87e09124ec446bb64f4392ef
Reverted commit D3979179

Summary:
When `delayed` is called on the Future, the underlying `futures::sleep` call runs on a timer thread, and the resulting callback is called on the same thread. Therefore, in the following sequence:

  f.via(&someExecutor).within(one_ms).then([&]() { /* [1] */ })

The code in [1] is not running in someExecutor. This can cause confusion by users of the library who expect the initial `via` to be sticky.

This change returns to the prior `Executor` after `delayed` is finished.

Reviewed By: yfeldblum

Differential Revision: D3979179

fbshipit-source-id: e1448f5603f0c9440490ae3bf0e670687f4179f3
folly/futures/Future-inl.h
folly/futures/test/TimekeeperTest.cpp