Add folly::tryEmplaceWith() helper for safely initialising a Try<T> with...
Add folly::tryEmplaceWith() helper for safely initialising a Try<T> with result of calling a function Summary: Adds a new folly::tryEmplaceWith() function that is the equivalent of makeTryWith() but for in-place initialisation of an existing Try<T> object. Using `tryEmplaceWith(t, func)` rather than `t = makeTryWith(func)` can potentially be more exception safe since the latter could potentially still throw if `Try<T>::operator=()` throws (ie. if T's move-constructor can throw). Updated FiberManager's internals to make use of this to fix a potential exception-safety issue that could have caused a memory leak if the Try<T> move-constructor of the result of fiber threw an exception. Reviewed By: yfeldblum Differential Revision: D9511067 fbshipit-source-id: 827cc88ea1d4fcd505c8d8a9886b87b26db90544
Showing
Please register or sign in to comment