diff options
author | Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> | 2022-08-19 14:16:14 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-08-19 15:44:26 +0300 |
commit | de7f1aa591881e112b67ec4f6507a6079b226089 (patch) | |
tree | 9a7c8ba0254c87df61b67964168d1c2df3b0db8b /src/py | |
parent | dfa86000a63f8d94399a28e5432e445239526389 (diff) |
py: Use libcamera's Mutex classes
Use libcamera's Mutex and MutexLocker instead of the std versions to get
thread safety annotations.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/py')
-rw-r--r-- | src/py/libcamera/py_camera_manager.cpp | 4 | ||||
-rw-r--r-- | src/py/libcamera/py_camera_manager.h | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/py/libcamera/py_camera_manager.cpp b/src/py/libcamera/py_camera_manager.cpp index 8bfb8e57..ea4ae825 100644 --- a/src/py/libcamera/py_camera_manager.cpp +++ b/src/py/libcamera/py_camera_manager.cpp @@ -106,14 +106,14 @@ void PyCameraManager::readFd() void PyCameraManager::pushRequest(Request *req) { - std::lock_guard guard(completedRequestsMutex_); + MutexLocker guard(completedRequestsMutex_); completedRequests_.push_back(req); } std::vector<Request *> PyCameraManager::getCompletedRequests() { std::vector<Request *> v; - std::lock_guard guard(completedRequestsMutex_); + MutexLocker guard(completedRequestsMutex_); swap(v, completedRequests_); return v; } diff --git a/src/py/libcamera/py_camera_manager.h b/src/py/libcamera/py_camera_manager.h index 710163e8..56bea13d 100644 --- a/src/py/libcamera/py_camera_manager.h +++ b/src/py/libcamera/py_camera_manager.h @@ -5,7 +5,7 @@ #pragma once -#include <mutex> +#include <libcamera/base/mutex.h> #include <libcamera/libcamera.h> @@ -34,8 +34,9 @@ private: std::unique_ptr<CameraManager> cameraManager_; UniqueFD eventFd_; - std::mutex completedRequestsMutex_; - std::vector<Request *> completedRequests_; + libcamera::Mutex completedRequestsMutex_; + std::vector<Request *> completedRequests_ + LIBCAMERA_TSA_GUARDED_BY(completedRequestsMutex_); void writeFd(); void readFd(); |