[libcamera-devel,v2,7/8] android: Rename CameraDevice::mutex_
diff mbox series

Message ID 20210513092246.42847-8-jacopo@jmondi.org
State Superseded
Delegated to: Jacopo Mondi
Headers show
Series
  • Implement flush() camera operation
Related show

Commit Message

Jacopo Mondi May 13, 2021, 9:22 a.m. UTC
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 <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
---
 src/android/camera_device.cpp | 4 ++--
 src/android/camera_device.h   | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

Comments

Hirokazu Honda May 17, 2021, 5:01 a.m. UTC | #1
Hi Jacopo, thank you for the patch.

On Thu, May 13, 2021 at 6:22 PM Jacopo Mondi <jacopo@jmondi.org> wrote:

> 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 <jacopo@jmondi.org>
> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
>

Reviewed-by: Hirokazu Honda <hiroh@chromium.org>


> ---
>  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<int, libcamera::PixelFormat> formatsMap_;
>         std::vector<CameraStream> streams_;
>
> -       std::mutex mutex_; /* Protect descriptors_ */
> +       libcamera::Mutex requestsMutex_; /* Protects descriptors_. */
>         std::map<uint64_t, Camera3RequestDescriptor> descriptors_;
>
>         std::string maker_;
> --
> 2.31.1
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
>

Patch
diff mbox series

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<int, libcamera::PixelFormat> formatsMap_;
 	std::vector<CameraStream> streams_;
 
-	std::mutex mutex_; /* Protect descriptors_ */
+	libcamera::Mutex requestsMutex_; /* Protects descriptors_. */
 	std::map<uint64_t, Camera3RequestDescriptor> descriptors_;
 
 	std::string maker_;