Introduce thenAsync method on Future (#57637)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/57637
I had proposes a similar method in https://github.com/pytorch/pytorch/pull/48790, although that PR was exposing it to Python and thus requires a bit more work. This PR only introduces this method as a C++ API. Python can be added later.
This new method is useful when one wants to use `then` but the callback does perform some async operation itself, and one wants to "reconcile" the future produced inside the callback with the one produced outside.
ghstack-source-id: 129567066
Test Plan: Used (and thus tested) later in the stack.
Reviewed By: mrshenli
Differential Revision: D28222809
fbshipit-source-id: 869f11ab390b15e80c0855750e616f41248686c5