[libcamera-devel,v3,06/12] libcamera: Correct include headers for Mutex classes
diff mbox series

Message ID 20211130155600.2203123-7-hiroh@chromium.org
State Superseded
Headers show
Series
  • Introduce clang thread safety annotations
Related show

Commit Message

Hirokazu Honda Nov. 30, 2021, 3:55 p.m. UTC
Mutex classes are defined in mutex.h. This replaces thread.h
include for the Mutex classes with mutex.h.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
---
 include/libcamera/base/semaphore.h | 2 +-
 include/libcamera/base/thread.h    | 1 -
 src/android/camera_device.cpp      | 1 -
 src/android/camera_device.h        | 2 +-
 src/android/camera_hal_manager.h   | 2 +-
 src/android/camera_request.h       | 2 +-
 src/android/camera_stream.h        | 1 +
 src/libcamera/base/semaphore.cpp   | 1 -
 src/libcamera/base/signal.cpp      | 3 +--
 src/libcamera/base/thread.cpp      | 1 +
 src/libcamera/camera_manager.cpp   | 1 +
 src/v4l2/v4l2_camera.h             | 2 +-
 12 files changed, 9 insertions(+), 10 deletions(-)

Comments

Laurent Pinchart Dec. 1, 2021, 12:19 a.m. UTC | #1
Hi Hiro,

Thank you for the patch.

On Wed, Dec 01, 2021 at 12:55:54AM +0900, Hirokazu Honda wrote:
> Mutex classes are defined in mutex.h. This replaces thread.h
> include for the Mutex classes with mutex.h.
> 
> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
> ---
>  include/libcamera/base/semaphore.h | 2 +-
>  include/libcamera/base/thread.h    | 1 -
>  src/android/camera_device.cpp      | 1 -
>  src/android/camera_device.h        | 2 +-
>  src/android/camera_hal_manager.h   | 2 +-
>  src/android/camera_request.h       | 2 +-
>  src/android/camera_stream.h        | 1 +
>  src/libcamera/base/semaphore.cpp   | 1 -
>  src/libcamera/base/signal.cpp      | 3 +--
>  src/libcamera/base/thread.cpp      | 1 +
>  src/libcamera/camera_manager.cpp   | 1 +
>  src/v4l2/v4l2_camera.h             | 2 +-
>  12 files changed, 9 insertions(+), 10 deletions(-)
> 
> diff --git a/include/libcamera/base/semaphore.h b/include/libcamera/base/semaphore.h
> index ec05fad3..271d5427 100644
> --- a/include/libcamera/base/semaphore.h
> +++ b/include/libcamera/base/semaphore.h
> @@ -8,7 +8,7 @@
>  #pragma once
>  
>  #include <libcamera/base/private.h>
> -#include <libcamera/base/thread.h>

I'd add a blank line here to match the usual practice.

> +#include <libcamera/base/mutex.h>
>  
>  namespace libcamera {
>  
> diff --git a/include/libcamera/base/thread.h b/include/libcamera/base/thread.h
> index 44678c34..9d00f102 100644
> --- a/include/libcamera/base/thread.h
> +++ b/include/libcamera/base/thread.h
> @@ -14,7 +14,6 @@
>  #include <libcamera/base/private.h>
>  
>  #include <libcamera/base/message.h>
> -#include <libcamera/base/mutex.h>
>  #include <libcamera/base/signal.h>
>  #include <libcamera/base/utils.h>
>  
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index f2e0bdbd..d74307a2 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -14,7 +14,6 @@
>  #include <vector>
>  
>  #include <libcamera/base/log.h>
> -#include <libcamera/base/thread.h>
>  #include <libcamera/base/utils.h>
>  
>  #include <libcamera/control_ids.h>
> diff --git a/src/android/camera_device.h b/src/android/camera_device.h
> index bda0b376..a945f5de 100644
> --- a/src/android/camera_device.h
> +++ b/src/android/camera_device.h
> @@ -17,7 +17,7 @@
>  #include <libcamera/base/class.h>
>  #include <libcamera/base/log.h>
>  #include <libcamera/base/message.h>
> -#include <libcamera/base/thread.h>
> +#include <libcamera/base/mutex.h>
>  
>  #include <libcamera/camera.h>
>  #include <libcamera/framebuffer.h>
> diff --git a/src/android/camera_hal_manager.h b/src/android/camera_hal_manager.h
> index cc310f90..765701b2 100644
> --- a/src/android/camera_hal_manager.h
> +++ b/src/android/camera_hal_manager.h
> @@ -17,7 +17,7 @@
>  #include <system/camera_metadata.h>
>  
>  #include <libcamera/base/class.h>
> -#include <libcamera/base/thread.h>
> +#include <libcamera/base/mutex.h>
>  
>  #include <libcamera/camera_manager.h>
>  
> diff --git a/src/android/camera_request.h b/src/android/camera_request.h
> index 88d501a8..887dbe86 100644
> --- a/src/android/camera_request.h
> +++ b/src/android/camera_request.h
> @@ -12,7 +12,7 @@
>  #include <vector>
>  
>  #include <libcamera/base/class.h>
> -#include <libcamera/base/thread.h>
> +#include <libcamera/base/mutex.h>
>  
>  #include <libcamera/camera.h>
>  #include <libcamera/framebuffer.h>
> diff --git a/src/android/camera_stream.h b/src/android/camera_stream.h
> index adb5a37d..e4eb953a 100644
> --- a/src/android/camera_stream.h
> +++ b/src/android/camera_stream.h
> @@ -13,6 +13,7 @@
>  
>  #include <hardware/camera3.h>
>  
> +#include <libcamera/base/mutex.h>
>  #include <libcamera/base/thread.h>
>  
>  #include <libcamera/camera.h>
> diff --git a/src/libcamera/base/semaphore.cpp b/src/libcamera/base/semaphore.cpp
> index bf730c87..4fe30293 100644
> --- a/src/libcamera/base/semaphore.cpp
> +++ b/src/libcamera/base/semaphore.cpp
> @@ -6,7 +6,6 @@
>   */
>  
>  #include <libcamera/base/semaphore.h>
> -#include <libcamera/base/thread.h>
>  
>  /**
>   * \file base/semaphore.h
> diff --git a/src/libcamera/base/signal.cpp b/src/libcamera/base/signal.cpp
> index 9c2319c5..2fd7e01d 100644
> --- a/src/libcamera/base/signal.cpp
> +++ b/src/libcamera/base/signal.cpp
> @@ -5,10 +5,9 @@
>   * signal.cpp - Signal & slot implementation
>   */
>  
> +#include <libcamera/base/mutex.h>
>  #include <libcamera/base/signal.h>
>  
> -#include <libcamera/base/thread.h>

mutex.h should go here, to keep signal.h first.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> -
>  /**
>   * \file base/signal.h
>   * \brief Signal & slot implementation
> diff --git a/src/libcamera/base/thread.cpp b/src/libcamera/base/thread.cpp
> index b2043b7e..6bda9d14 100644
> --- a/src/libcamera/base/thread.cpp
> +++ b/src/libcamera/base/thread.cpp
> @@ -17,6 +17,7 @@
>  #include <libcamera/base/event_dispatcher_poll.h>
>  #include <libcamera/base/log.h>
>  #include <libcamera/base/message.h>
> +#include <libcamera/base/mutex.h>
>  
>  /**
>   * \page thread Thread Support
> diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp
> index 77ff3bd1..70d73822 100644
> --- a/src/libcamera/camera_manager.cpp
> +++ b/src/libcamera/camera_manager.cpp
> @@ -12,6 +12,7 @@
>  #include <libcamera/camera.h>
>  
>  #include <libcamera/base/log.h>
> +#include <libcamera/base/mutex.h>
>  #include <libcamera/base/thread.h>
>  #include <libcamera/base/utils.h>
>  
> diff --git a/src/v4l2/v4l2_camera.h b/src/v4l2/v4l2_camera.h
> index bf1b6de4..9307d61d 100644
> --- a/src/v4l2/v4l2_camera.h
> +++ b/src/v4l2/v4l2_camera.h
> @@ -10,8 +10,8 @@
>  #include <deque>
>  #include <utility>
>  
> +#include <libcamera/base/mutex.h>
>  #include <libcamera/base/semaphore.h>
> -#include <libcamera/base/thread.h>
>  
>  #include <libcamera/camera.h>
>  #include <libcamera/file_descriptor.h>

Patch
diff mbox series

diff --git a/include/libcamera/base/semaphore.h b/include/libcamera/base/semaphore.h
index ec05fad3..271d5427 100644
--- a/include/libcamera/base/semaphore.h
+++ b/include/libcamera/base/semaphore.h
@@ -8,7 +8,7 @@ 
 #pragma once
 
 #include <libcamera/base/private.h>
-#include <libcamera/base/thread.h>
+#include <libcamera/base/mutex.h>
 
 namespace libcamera {
 
diff --git a/include/libcamera/base/thread.h b/include/libcamera/base/thread.h
index 44678c34..9d00f102 100644
--- a/include/libcamera/base/thread.h
+++ b/include/libcamera/base/thread.h
@@ -14,7 +14,6 @@ 
 #include <libcamera/base/private.h>
 
 #include <libcamera/base/message.h>
-#include <libcamera/base/mutex.h>
 #include <libcamera/base/signal.h>
 #include <libcamera/base/utils.h>
 
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index f2e0bdbd..d74307a2 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -14,7 +14,6 @@ 
 #include <vector>
 
 #include <libcamera/base/log.h>
-#include <libcamera/base/thread.h>
 #include <libcamera/base/utils.h>
 
 #include <libcamera/control_ids.h>
diff --git a/src/android/camera_device.h b/src/android/camera_device.h
index bda0b376..a945f5de 100644
--- a/src/android/camera_device.h
+++ b/src/android/camera_device.h
@@ -17,7 +17,7 @@ 
 #include <libcamera/base/class.h>
 #include <libcamera/base/log.h>
 #include <libcamera/base/message.h>
-#include <libcamera/base/thread.h>
+#include <libcamera/base/mutex.h>
 
 #include <libcamera/camera.h>
 #include <libcamera/framebuffer.h>
diff --git a/src/android/camera_hal_manager.h b/src/android/camera_hal_manager.h
index cc310f90..765701b2 100644
--- a/src/android/camera_hal_manager.h
+++ b/src/android/camera_hal_manager.h
@@ -17,7 +17,7 @@ 
 #include <system/camera_metadata.h>
 
 #include <libcamera/base/class.h>
-#include <libcamera/base/thread.h>
+#include <libcamera/base/mutex.h>
 
 #include <libcamera/camera_manager.h>
 
diff --git a/src/android/camera_request.h b/src/android/camera_request.h
index 88d501a8..887dbe86 100644
--- a/src/android/camera_request.h
+++ b/src/android/camera_request.h
@@ -12,7 +12,7 @@ 
 #include <vector>
 
 #include <libcamera/base/class.h>
-#include <libcamera/base/thread.h>
+#include <libcamera/base/mutex.h>
 
 #include <libcamera/camera.h>
 #include <libcamera/framebuffer.h>
diff --git a/src/android/camera_stream.h b/src/android/camera_stream.h
index adb5a37d..e4eb953a 100644
--- a/src/android/camera_stream.h
+++ b/src/android/camera_stream.h
@@ -13,6 +13,7 @@ 
 
 #include <hardware/camera3.h>
 
+#include <libcamera/base/mutex.h>
 #include <libcamera/base/thread.h>
 
 #include <libcamera/camera.h>
diff --git a/src/libcamera/base/semaphore.cpp b/src/libcamera/base/semaphore.cpp
index bf730c87..4fe30293 100644
--- a/src/libcamera/base/semaphore.cpp
+++ b/src/libcamera/base/semaphore.cpp
@@ -6,7 +6,6 @@ 
  */
 
 #include <libcamera/base/semaphore.h>
-#include <libcamera/base/thread.h>
 
 /**
  * \file base/semaphore.h
diff --git a/src/libcamera/base/signal.cpp b/src/libcamera/base/signal.cpp
index 9c2319c5..2fd7e01d 100644
--- a/src/libcamera/base/signal.cpp
+++ b/src/libcamera/base/signal.cpp
@@ -5,10 +5,9 @@ 
  * signal.cpp - Signal & slot implementation
  */
 
+#include <libcamera/base/mutex.h>
 #include <libcamera/base/signal.h>
 
-#include <libcamera/base/thread.h>
-
 /**
  * \file base/signal.h
  * \brief Signal & slot implementation
diff --git a/src/libcamera/base/thread.cpp b/src/libcamera/base/thread.cpp
index b2043b7e..6bda9d14 100644
--- a/src/libcamera/base/thread.cpp
+++ b/src/libcamera/base/thread.cpp
@@ -17,6 +17,7 @@ 
 #include <libcamera/base/event_dispatcher_poll.h>
 #include <libcamera/base/log.h>
 #include <libcamera/base/message.h>
+#include <libcamera/base/mutex.h>
 
 /**
  * \page thread Thread Support
diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp
index 77ff3bd1..70d73822 100644
--- a/src/libcamera/camera_manager.cpp
+++ b/src/libcamera/camera_manager.cpp
@@ -12,6 +12,7 @@ 
 #include <libcamera/camera.h>
 
 #include <libcamera/base/log.h>
+#include <libcamera/base/mutex.h>
 #include <libcamera/base/thread.h>
 #include <libcamera/base/utils.h>
 
diff --git a/src/v4l2/v4l2_camera.h b/src/v4l2/v4l2_camera.h
index bf1b6de4..9307d61d 100644
--- a/src/v4l2/v4l2_camera.h
+++ b/src/v4l2/v4l2_camera.h
@@ -10,8 +10,8 @@ 
 #include <deque>
 #include <utility>
 
+#include <libcamera/base/mutex.h>
 #include <libcamera/base/semaphore.h>
-#include <libcamera/base/thread.h>
 
 #include <libcamera/camera.h>
 #include <libcamera/file_descriptor.h>