Make await exception safe
authorAndrii Grynenko <andrii@fb.com>
Mon, 16 May 2016 20:13:24 +0000 (13:13 -0700)
committerFacebook Github Bot 2 <facebook-github-bot-2-bot@fb.com>
Mon, 16 May 2016 20:23:27 +0000 (13:23 -0700)
commit9b311838f4bf5fd9037949cc5910d8c66c26fcaa
tree647a9dbf766a0962a7a4394fe6c67f0de74ea40c
parente788c8cab2385ecf1ef2c5a88623b89ea4f7152e
Make await exception safe

Summary: This fixes fibers::await to correctly handle exception thrown by user-passed lambda. Await still always waits for the promise to be fulfilled (if the promise was not moved out, it will be destroyed and thus auto-fulfilled with "promise not fulfilled" exception). However if user-passed lambda throws, promise result is ignored (even if exception) and exception thrown by lambda is re-thrown.

Reviewed By: pavlo-fb

Differential Revision: D3303393

fbshipit-source-id: c4ba01fde0e156cc88e5d07aaf763e3abe121d11
folly/experimental/fibers/FiberManager-inl.h
folly/experimental/fibers/test/FibersTest.cpp