[libcamera-devel,06/20] ipa: rpi: Add try_lock() to RPiController::Metadata
diff mbox series

Message ID 20231006132000.23504-7-naush@raspberrypi.com
State Superseded
Headers show
Series
  • Raspberry Pi: Preliminary PiSP support
Related show

Commit Message

Naushir Patuck Oct. 6, 2023, 1:19 p.m. UTC
Add the missing try_lock() member function to RPiController::Metadata.
This will allow RPiController::Metadata to be used as a template
parameter in std::scoped_lock.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
---
 src/ipa/rpi/controller/metadata.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Jacopo Mondi Oct. 12, 2023, 8:22 a.m. UTC | #1
Hi Naush

On Fri, Oct 06, 2023 at 02:19:46PM +0100, Naushir Patuck via libcamera-devel wrote:
> Add the missing try_lock() member function to RPiController::Metadata.
> This will allow RPiController::Metadata to be used as a template
> parameter in std::scoped_lock.
>
> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

Thanks
  j

> ---
>  src/ipa/rpi/controller/metadata.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/ipa/rpi/controller/metadata.h b/src/ipa/rpi/controller/metadata.h
> index bf8a2393457a..a232dcb12456 100644
> --- a/src/ipa/rpi/controller/metadata.h
> +++ b/src/ipa/rpi/controller/metadata.h
> @@ -116,6 +116,7 @@ public:
>  	 * e.g. std::lock_guard<RPiController::Metadata> lock(metadata)
>  	 */
>  	void lock() LIBCAMERA_TSA_ACQUIRE() { mutex_.lock(); }
> +	auto try_lock() LIBCAMERA_TSA_ACQUIRE() { return mutex_.try_lock(); }
>  	void unlock() LIBCAMERA_TSA_RELEASE() { mutex_.unlock(); }
>
>  private:
> --
> 2.34.1
>

Patch
diff mbox series

diff --git a/src/ipa/rpi/controller/metadata.h b/src/ipa/rpi/controller/metadata.h
index bf8a2393457a..a232dcb12456 100644
--- a/src/ipa/rpi/controller/metadata.h
+++ b/src/ipa/rpi/controller/metadata.h
@@ -116,6 +116,7 @@  public:
 	 * e.g. std::lock_guard<RPiController::Metadata> lock(metadata)
 	 */
 	void lock() LIBCAMERA_TSA_ACQUIRE() { mutex_.lock(); }
+	auto try_lock() LIBCAMERA_TSA_ACQUIRE() { return mutex_.try_lock(); }
 	void unlock() LIBCAMERA_TSA_RELEASE() { mutex_.unlock(); }
 
 private: