summaryrefslogtreecommitdiff
path: root/src/common/scope_exit.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-02-05 23:00:43 -0800
committerGitHub <noreply@github.com>2021-02-05 23:00:43 -0800
commit1498a7c9a84037d7c78ff21b3bc996622269db43 (patch)
tree0fb418f721db6e307fb7105cc57fe3a2eec7d0bf /src/common/scope_exit.h
parent3a804752cb4c6a9af3f35d8239bb7d12fb9cf9c2 (diff)
parentea4f62615e71cd2b680517b7609928ed0abf216d (diff)
Merge pull request #5862 from bunnei/kevent
Kernel Rework: Refactor KEvent/KReadableEvent/KWritableEvent
Diffstat (limited to 'src/common/scope_exit.h')
-rw-r--r--src/common/scope_exit.h6
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) {
* \endcode
*/
#define SCOPE_EXIT(body) auto CONCAT2(scope_exit_helper_, __LINE__) = detail::ScopeExit([&]() body)
+
+/**
+ * This macro is similar to SCOPE_EXIT, except the object is caller managed. This is intended to be
+ * used when the caller might want to cancel the ScopeExit.
+ */
+#define SCOPE_GUARD(body) detail::ScopeExit([&]() body)