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 <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
This commit is contained in:
Laurent Pinchart 2021-08-29 21:10:57 +03:00
parent ec6921d7f7
commit 152adad97a
2 changed files with 8 additions and 1 deletions

View file

@ -14,6 +14,7 @@
#include <sys/types.h>
#include <vector>
#include <libcamera/base/mutex.h>
#include <libcamera/base/object.h>
#include <libcamera/controls.h>
@ -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;
};