summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHirokazu Honda <hiroh@chromium.org>2021-12-01 16:53:47 +0900
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-12-01 13:46:57 +0200
commit221cf408f316eb2dc1cb96986053e2005fd36f39 (patch)
treee6e9dba5a027a174fcdab95015c6d98b31420482 /src
parentf6807016a37fc11f8c93f105569f04fa1a2326e7 (diff)
android: camera_device: Add thread safety annotation
This applies clang thread safety annotation to CameraDevice. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/android/camera_device.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/android/camera_device.h b/src/android/camera_device.h
index a945f5de..e5d9cda2 100644
--- a/src/android/camera_device.h
+++ b/src/android/camera_device.h
@@ -82,7 +82,7 @@ private:
Running,
};
- void stop();
+ void stop() LIBCAMERA_TSA_EXCLUDES(stateMutex_);
std::unique_ptr<libcamera::FrameBuffer>
createFrameBuffer(const buffer_handle_t camera3buffer,
@@ -94,8 +94,9 @@ private:
void notifyError(uint32_t frameNumber, camera3_stream_t *stream,
camera3_error_msg_code code) const;
int processControls(Camera3RequestDescriptor *descriptor);
- void completeDescriptor(Camera3RequestDescriptor *descriptor);
- void sendCaptureResults();
+ void completeDescriptor(Camera3RequestDescriptor *descriptor)
+ LIBCAMERA_TSA_EXCLUDES(descriptorsMutex_);
+ void sendCaptureResults() LIBCAMERA_TSA_REQUIRES(descriptorsMutex_);
void setBufferStatus(Camera3RequestDescriptor::StreamBuffer &buffer,
Camera3RequestDescriptor::Status status);
std::unique_ptr<CameraMetadata> getResultMetadata(
@@ -107,7 +108,7 @@ private:
CameraWorker worker_;
libcamera::Mutex stateMutex_; /* Protects access to the camera state. */
- State state_;
+ State state_ LIBCAMERA_TSA_GUARDED_BY(stateMutex_);
std::shared_ptr<libcamera::Camera> camera_;
std::unique_ptr<libcamera::CameraConfiguration> config_;
@@ -118,8 +119,9 @@ private:
std::vector<CameraStream> streams_;
- libcamera::Mutex descriptorsMutex_; /* Protects descriptors_. */
- std::queue<std::unique_ptr<Camera3RequestDescriptor>> descriptors_;
+ libcamera::Mutex descriptorsMutex_ LIBCAMERA_TSA_ACQUIRED_AFTER(stateMutex_);
+ std::queue<std::unique_ptr<Camera3RequestDescriptor>> descriptors_
+ LIBCAMERA_TSA_GUARDED_BY(descriptorsMutex_);
std::string maker_;
std::string model_;