From 152adad97a95c15ae9ac2e1889f94a3dc6412165 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 29 Aug 2021 21:10:57 +0300 Subject: libcamera: pipeline_handler: Make lock() and unlock() thread-safe The PipelineHandler lock() and unlock() functions are documented as thread-safe, but they're not. Fix them using a mutex. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi Reviewed-by: Umang Jain --- include/libcamera/internal/pipeline_handler.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/libcamera/internal') diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h index a7331ced..e5b8ffb4 100644 --- a/include/libcamera/internal/pipeline_handler.h +++ b/include/libcamera/internal/pipeline_handler.h @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -88,7 +89,8 @@ private: const char *name_; - bool lockOwner_; + Mutex lock_; + bool lockOwner_ LIBCAMERA_TSA_GUARDED_BY(lock_); /* *Not* ownership of lock_ */ friend class PipelineHandlerFactory; }; -- cgit v1.2.1