Allow creation of dismissed ScopeGuards
Summary: This diff enables a symmetrical pattern to `makeGuard()`/`dismiss()`: `makeDismissedGuard()` will create a guard that will not execute unless `rehired()`'d. This is for use cases where the guard's scope is wider than where the condition on whether it should execute is evaluated. For example ``` State state; auto guard = makeDismissedGuard([&] { cleanup(state); }); if (modifyStateInAWayThatRequiresCleanup(state)) { guard.rehire(); } // Use state. ``` Reviewed By: yfeldblum Differential Revision: D27931274 fbshipit-source-id: fbf7048dc991b73553cd6429f5e73345e4104d49
Showing
Please register or sign in to comment