[libcamera-devel] [PATCH v2 2/3] ipa: raspberrypi: Add move operator to RPiController::Metadata
David Plowman
david.plowman at raspberrypi.com
Fri Apr 16 15:15:25 CEST 2021
Hi Naush
Thanks for adding this function.
On Fri, 16 Apr 2021 at 11:31, Naushir Patuck <naush at raspberrypi.com> wrote:
>
> 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();
I did wonder slightly whether you need the explicit "clear" here, but
I guess you probably do - it's left in a "valid but unspecified" state
(even though in practice that would normally turn out to be empty).
So:
Reviewed-by: David Plowman <david.plowman at raspberrypi.com>
Thanks!
David
> + 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