[libcamera-devel] [PATCH v3 07/12] android: camera_hal_manager: Add thread safety annotation
Hirokazu Honda
hiroh at chromium.org
Tue Nov 30 16:55:55 CET 2021
This applies clang thread safety annotation to CameraHalManager.
Signed-off-by: Hirokazu Honda <hiroh at chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain at ideasonboard.com>
---
src/android/camera_hal_manager.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/android/camera_hal_manager.h b/src/android/camera_hal_manager.h
index 765701b2..5395d419 100644
--- a/src/android/camera_hal_manager.h
+++ b/src/android/camera_hal_manager.h
@@ -18,6 +18,7 @@
#include <libcamera/base/class.h>
#include <libcamera/base/mutex.h>
+#include <libcamera/base/thread_annotations.h>
#include <libcamera/camera_manager.h>
@@ -53,14 +54,14 @@ private:
void cameraAdded(std::shared_ptr<libcamera::Camera> cam);
void cameraRemoved(std::shared_ptr<libcamera::Camera> cam);
- CameraDevice *cameraDeviceFromHalId(unsigned int id);
+ CameraDevice *cameraDeviceFromHalId(unsigned int id) LIBCAMERA_TSA_REQUIRES(mutex_);
std::unique_ptr<libcamera::CameraManager> cameraManager_;
CameraHalConfig halConfig_;
const camera_module_callbacks_t *callbacks_;
- std::vector<std::unique_ptr<CameraDevice>> cameras_;
- std::map<std::string, unsigned int> cameraIdsMap_;
+ std::vector<std::unique_ptr<CameraDevice>> cameras_ LIBCAMERA_TSA_GUARDED_BY(mutex_);
+ std::map<std::string, unsigned int> cameraIdsMap_ LIBCAMERA_TSA_GUARDED_BY(mutex_);
libcamera::Mutex mutex_;
unsigned int numInternalCameras_;
--
2.34.0.rc2.393.gf8c9666880-goog
More information about the libcamera-devel
mailing list