[libcamera-devel] [PATCH v2 2/3] ipa: raspberrypi: Add move operator to RPiController::Metadata

Naushir Patuck naush at raspberrypi.com
Fri Apr 16 12:31:40 CEST 2021


Add the move operator implementation for the RPiController::Metadata
class.

Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
---
 src/ipa/raspberrypi/controller/metadata.hpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/ipa/raspberrypi/controller/metadata.hpp b/src/ipa/raspberrypi/controller/metadata.hpp
index 4f44ffc6771c..c55194040f2f 100644
--- a/src/ipa/raspberrypi/controller/metadata.hpp
+++ b/src/ipa/raspberrypi/controller/metadata.hpp
@@ -45,6 +45,14 @@ public:
 		data_ = other.data_;
 		return *this;
 	}
+	Metadata &operator=(Metadata &&other)
+	{
+		std::lock_guard<std::mutex> lock(mutex_);
+		std::lock_guard<std::mutex> other_lock(other.mutex_);
+		data_ = std::move(other.data_);
+		other.data_.clear();
+		return *this;
+	}
 	template<typename T> T *GetLocked(std::string const &tag)
 	{
 		// This allows in-place access to the Metadata contents,
-- 
2.25.1



More information about the libcamera-devel mailing list