summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/base/utils.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/libcamera/base/utils.h b/include/libcamera/base/utils.h
index a9b27d0f..957150cb 100644
--- a/include/libcamera/base/utils.h
+++ b/include/libcamera/base/utils.h
@@ -9,6 +9,7 @@
#include <algorithm>
#include <chrono>
+#include <functional>
#include <iterator>
#include <ostream>
#include <sstream>
@@ -398,6 +399,18 @@ constexpr std::underlying_type_t<Enum> to_underlying(Enum e) noexcept
return static_cast<std::underlying_type_t<Enum>>(e);
}
+class ScopeExitActions
+{
+public:
+ ~ScopeExitActions();
+
+ void operator+=(std::function<void()> &&action);
+ void release();
+
+private:
+ std::vector<std::function<void()>> actions_;
+};
+
} /* namespace utils */
#ifndef __DOXYGEN__