From 88d059105b611be03d67559aa7fbbab7c45c8ace Mon Sep 17 00:00:00 2001 From: Nicholas Roth Date: Thu, 27 Oct 2022 22:17:18 -0500 Subject: ipa: add missing thread-safety annotations The raspberrypi IPA is missing thread-safety annotations, which breaks the build. Add required thread-safety annotations. ../src/ipa/raspberrypi/controller/metadata.h:108:31: error: mutex 'mutex_' is still held at the end of function [-Werror,-Wthread-safety-analysis] void lock() { mutex_.lock(); } ^ ../src/ipa/raspberrypi/controller/metadata.h:108:23: note: mutex acquired here void lock() { mutex_.lock(); } ^ ../src/ipa/raspberrypi/controller/metadata.h:109:25: error: releasing mutex 'mutex_' that was not held [-Werror,-Wthread-safety-analysis] void unlock() { mutex_.unlock(); } ^ Signed-off-by: Nicholas Roth Reviewed-by: Jacopo Mondi Reviewed-by: Kieran Bingham Reviewed-by: Naushir Patuck Signed-off-by: Kieran Bingham --- src/ipa/raspberrypi/controller/metadata.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ipa/raspberrypi/controller/metadata.h b/src/ipa/raspberrypi/controller/metadata.h index 0f7ebfaf..870b6e26 100644 --- a/src/ipa/raspberrypi/controller/metadata.h +++ b/src/ipa/raspberrypi/controller/metadata.h @@ -13,9 +13,11 @@ #include #include +#include + namespace RPiController { -class Metadata +class LIBCAMERA_TSA_CAPABILITY("mutex") Metadata { public: Metadata() = default; @@ -103,8 +105,8 @@ public: * locks with the standard lock classes. * e.g. std::lock_guard lock(metadata) */ - void lock() { mutex_.lock(); } - void unlock() { mutex_.unlock(); } + void lock() LIBCAMERA_TSA_ACQUIRE() { mutex_.lock(); } + void unlock() LIBCAMERA_TSA_RELEASE() { mutex_.unlock(); } private: mutable std::mutex mutex_; -- cgit v1.2.1