[libcamera-devel] [PATCH 3/7] ipa: raspberrypi: awb: Apply clang thread annotation

Hirokazu Honda hiroh at chromium.org
Fri Dec 3 20:55:35 CET 2021


This annotates member functions and variables of Awb by clang
thread safety annotations.

Signed-off-by: Hirokazu Honda <hiroh at chromium.org>
---
 src/ipa/raspberrypi/controller/rpi/awb.cpp | 2 +-
 src/ipa/raspberrypi/controller/rpi/awb.hpp | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/ipa/raspberrypi/controller/rpi/awb.cpp b/src/ipa/raspberrypi/controller/rpi/awb.cpp
index b4e45abf..ac253d6b 100644
--- a/src/ipa/raspberrypi/controller/rpi/awb.cpp
+++ b/src/ipa/raspberrypi/controller/rpi/awb.cpp
@@ -318,7 +318,7 @@ void Awb::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/awb.hpp b/src/ipa/raspberrypi/controller/rpi/awb.hpp
index 30f39c4a..413e0439 100644
--- a/src/ipa/raspberrypi/controller/rpi/awb.hpp
+++ b/src/ipa/raspberrypi/controller/rpi/awb.hpp
@@ -114,11 +114,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
@@ -133,7 +133,7 @@ private:
 	// thread can set/reset them if the async thread is known to be idle:
 	void restartAsync(StatisticsPtr &stats, double lux);
 	// copy out the results from the async thread so that it can be restarted
-	void fetchAsyncResults();
+	void fetchAsyncResults() LIBCAMERA_TSA_REQUIRES(mutex_);
 	StatisticsPtr statistics_;
 	AwbMode *mode_;
 	double lux_;
-- 
2.34.1.400.ga245620fadb-goog



More information about the libcamera-devel mailing list