Add folly::coro::timeout() algorithm
Summary: This algorithm takes an awaitable and a duration and cancels the operation and completes with a `FutureTimeout` error if the operation does not complete within the specified duration. This differs from `timed_wait()` in that it still waits for the child operation to complete, even once the timeout has elapsed, rather than just detaching from the operation and letting it complete in the background. This relies on the operation responding to cancellation in a timely manner for the algorithm to have the effect of returning shortly after the timeout elapses. The benefit of waiting for the child operation to complete, however, is that it allows you to safely pass parameters by reference to the child operation and be safe in knowing that the child operation will complete before the awaiting coroutine resumes and potentially destroys those parameters. Reviewed By: yfeldblum Differential Revision: D22199932 fbshipit-source-id: 4f6295a23a860ec52b639eb56a02f8029ffb9009
Showing
Please register or sign in to comment