From patchwork Thu May 13 09:22:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 12269 X-Patchwork-Delegate: jacopo@jmondi.org Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id F3F96C31EE for ; Thu, 13 May 2021 09:22:15 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6F31A68930; Thu, 13 May 2021 11:22:15 +0200 (CEST) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2175C68922 for ; Thu, 13 May 2021 11:22:12 +0200 (CEST) Received: from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) (Authenticated sender: jacopo@jmondi.org) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 7E9E2240006; Thu, 13 May 2021 09:22:11 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Thu, 13 May 2021 11:22:45 +0200 Message-Id: <20210513092246.42847-8-jacopo@jmondi.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210513092246.42847-1-jacopo@jmondi.org> References: <20210513092246.42847-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 7/8] android: Rename CameraDevice::mutex_ X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" With the introduction of an additional mutex class member, the name of the existing one is too generic. Rename CameraDevice::mutex_ in CameraDevice::requestsMutex_ and use the libcamera provided libcamera::Mutex type to align the style with the rest of the code base. Signed-off-by: Jacopo Mondi Reviewed-by: Niklas Söderlund Reviewed-by: Hirokazu Honda --- src/android/camera_device.cpp | 4 ++-- src/android/camera_device.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index c6cd0b6e8be7..7f8c9bd7832d 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -2024,7 +2024,7 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques worker_.queueRequest(descriptor.request_.get()); { - MutexLocker lock(mutex_); + MutexLocker requestsLock(requestsMutex_); descriptors_[descriptor.request_->cookie()] = std::move(descriptor); } @@ -2035,7 +2035,7 @@ void CameraDevice::requestComplete(Request *request) { decltype(descriptors_)::node_type node; { - MutexLocker lock(mutex_); + MutexLocker requestsLock(requestsMutex_); auto it = descriptors_.find(request->cookie()); if (it == descriptors_.end()) { /* diff --git a/src/android/camera_device.h b/src/android/camera_device.h index f263fdae472a..ed992ae56d5d 100644 --- a/src/android/camera_device.h +++ b/src/android/camera_device.h @@ -24,6 +24,7 @@ #include "libcamera/internal/buffer.h" #include "libcamera/internal/log.h" #include "libcamera/internal/message.h" +#include "libcamera/internal/thread.h" #include "camera_metadata.h" #include "camera_stream.h" @@ -134,7 +135,7 @@ private: std::map formatsMap_; std::vector streams_; - std::mutex mutex_; /* Protect descriptors_ */ + libcamera::Mutex requestsMutex_; /* Protects descriptors_. */ std::map descriptors_; std::string maker_;