diff options
Diffstat (limited to 'src/common/scope_exit.h')
| -rw-r--r-- | src/common/scope_exit.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/common/scope_exit.h b/src/common/scope_exit.h index fa46cb394..35dac3a8f 100644 --- a/src/common/scope_exit.h +++ b/src/common/scope_exit.h | |||
| @@ -49,3 +49,9 @@ ScopeExitHelper<Func> ScopeExit(Func&& func) { | |||
| 49 | * \endcode | 49 | * \endcode |
| 50 | */ | 50 | */ |
| 51 | #define SCOPE_EXIT(body) auto CONCAT2(scope_exit_helper_, __LINE__) = detail::ScopeExit([&]() body) | 51 | #define SCOPE_EXIT(body) auto CONCAT2(scope_exit_helper_, __LINE__) = detail::ScopeExit([&]() body) |
| 52 | |||
| 53 | /** | ||
| 54 | * This macro is similar to SCOPE_EXIT, except the object is caller managed. This is intended to be | ||
| 55 | * used when the caller might want to cancel the ScopeExit. | ||
| 56 | */ | ||
| 57 | #define SCOPE_GUARD(body) detail::ScopeExit([&]() body) | ||