libcamera: base: thread: Apply clang thread safety annotation
This annotates member variables of ThreadData by clang thread safety annotations. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
This commit is contained in:
parent
b5d26eab4d
commit
c39885ed9b
1 changed files with 7 additions and 3 deletions
|
@ -151,7 +151,7 @@ private:
|
|||
friend class ThreadMain;
|
||||
|
||||
Thread *thread_;
|
||||
bool running_;
|
||||
bool running_ LIBCAMERA_TSA_GUARDED_BY(mutex_);
|
||||
pid_t tid_;
|
||||
|
||||
Mutex mutex_;
|
||||
|
@ -422,11 +422,15 @@ bool Thread::wait(utils::duration duration)
|
|||
{
|
||||
MutexLocker locker(data_->mutex_);
|
||||
|
||||
auto isRunning = ([&]() LIBCAMERA_TSA_REQUIRES(data_->mutex_) {
|
||||
return !data_->running_;
|
||||
});
|
||||
|
||||
if (duration == utils::duration::max())
|
||||
data_->cv_.wait(locker, [&]() { return !data_->running_; });
|
||||
data_->cv_.wait(locker, isRunning);
|
||||
else
|
||||
hasFinished = data_->cv_.wait_for(locker, duration,
|
||||
[&]() { return !data_->running_; });
|
||||
isRunning);
|
||||
}
|
||||
|
||||
if (thread_.joinable())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue