[libcamera-devel] [PATCH 2/7] ipa: raspberrypi: alsc: Apply clang thread annotation
Hirokazu Honda
hiroh at chromium.org
Fri Dec 3 20:55:34 CET 2021
This annotates member functions and variables of Alsc by clang
thread safety annotations.
Signed-off-by: Hirokazu Honda <hiroh at chromium.org>
---
src/ipa/raspberrypi/controller/rpi/alsc.cpp | 4 ++--
src/ipa/raspberrypi/controller/rpi/alsc.hpp | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/ipa/raspberrypi/controller/rpi/alsc.cpp b/src/ipa/raspberrypi/controller/rpi/alsc.cpp
index 97a05a30..8f954106 100644
--- a/src/ipa/raspberrypi/controller/rpi/alsc.cpp
+++ b/src/ipa/raspberrypi/controller/rpi/alsc.cpp
@@ -180,7 +180,7 @@ void Alsc::waitForAysncThread()
if (async_started_) {
async_started_ = false;
MutexLocker lock(mutex_);
- sync_signal_.wait(lock, [&] {
+ sync_signal_.wait(lock, [&]() LIBCAMERA_TSA_REQUIRES(mutex_) {
return async_finished_;
});
async_finished_ = false;
@@ -371,7 +371,7 @@ void Alsc::asyncFunc()
while (true) {
{
MutexLocker lock(mutex_);
- async_signal_.wait(lock, [&] {
+ async_signal_.wait(lock, [&]() LIBCAMERA_TSA_REQUIRES(mutex_) {
return async_start_ || async_abort_;
});
async_start_ = false;
diff --git a/src/ipa/raspberrypi/controller/rpi/alsc.hpp b/src/ipa/raspberrypi/controller/rpi/alsc.hpp
index 3f9d6837..f1f2aa0d 100644
--- a/src/ipa/raspberrypi/controller/rpi/alsc.hpp
+++ b/src/ipa/raspberrypi/controller/rpi/alsc.hpp
@@ -69,11 +69,11 @@ private:
// condvar for synchronous thread to wait on
libcamera::ConditionVariable sync_signal_;
// for sync thread to check if async thread finished (requires mutex)
- bool async_finished_;
+ bool async_finished_ LIBCAMERA_TSA_GUARDED_BY(mutex_);
// for async thread to check if it's been told to run (requires mutex)
- bool async_start_;
+ bool async_start_ LIBCAMERA_TSA_GUARDED_BY(mutex_);
// for async thread to check if it's been told to quit (requires mutex)
- bool async_abort_;
+ bool async_abort_ LIBCAMERA_TSA_GUARDED_BY(mutex_);
// The following are only for the synchronous thread to use:
// for sync thread to note its has asked async thread to run
@@ -91,7 +91,7 @@ private:
// thread can set/reset them if the async thread is known to be idle:
void restartAsync(StatisticsPtr &stats, Metadata *image_metadata);
// copy out the results from the async thread so that it can be restarted
- void fetchAsyncResults();
+ void fetchAsyncResults() LIBCAMERA_TSA_REQUIRES(mutex_);
double ct_;
bcm2835_isp_stats_region statistics_[ALSC_CELLS_Y * ALSC_CELLS_X];
double async_results_[3][ALSC_CELLS_Y][ALSC_CELLS_X];
--
2.34.1.400.ga245620fadb-goog
More information about the libcamera-devel
mailing list