From patchwork Fri Dec 3 16:46:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 15014 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 20A40BF415 for ; Fri, 3 Dec 2021 16:46:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C8B4860868; Fri, 3 Dec 2021 17:46:31 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Hqrp0BWW"; dkim-atps=neutral Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3B51560725 for ; Fri, 3 Dec 2021 17:46:28 +0100 (CET) Received: by mail-pf1-x42e.google.com with SMTP id g19so3428253pfb.8 for ; Fri, 03 Dec 2021 08:46:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y52fm6Sy+pHSqMgq0LX0xKuz3zoSutkdmb2WDagTxcM=; b=Hqrp0BWW8/0cDa0fZAaeq/nY4o21bqDjLbxTaIhJTIap8i/bQJtdPkFKJidn6uWZY5 AMYQxq10qOpveemj8Cj2H9lqWH/7ctcVt2jMvxXd2ImjmBQQpBCLl3bDpLDN6eC5A9E4 J3/8Pw0Q9uf59mVYxvvrU9ctjdpdoor+urYQ8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y52fm6Sy+pHSqMgq0LX0xKuz3zoSutkdmb2WDagTxcM=; b=aqg8JIZBaxj00FtSdq7ZGWFXk/uGUmX0Ci3FWGHkuKLrN9TxQVFNycadyXEpoLhHd3 +ed9ef7/NJ3ALYGgudNE+BU+5FKbgRgLrKnElxNyG8ef3Y4rPI6dZg83tgvU01DVZg+P 81iaMcsvmHtOPE3nNCSFB1vmHuJ1oZHQPGgEp3jYLJLyM9q6awFHEYJhQYnxtRJG2gom OaaVCYEW3OjMuZnUxbAcUxHjJDCHHNQGblv/DzH/R8K/6FlNTvMrxEBS3O4pXM4hBQ/7 6N9KtZlEvdCiMYnIqWaD+gLlwr/0olITLhOc29HNIUCUPNNx+cDCKu1CXr5eN4dJDcJi DGoQ== X-Gm-Message-State: AOAM530Tb/vR24yHI4VrnfJ8fpUjrdoCMNlPeGfG8nhuqzRkuDvQylMj 7LC0QyoKhkkFT65OdttrS3cq3n6UBaKbBQ== X-Google-Smtp-Source: ABdhPJyDxW4hSLL2pwHyCHCUemjXMmGhrweF0gIunMOn07Ji3Kp6ix3c3jyMLiQe4x8oyjJNQMQKnQ== X-Received: by 2002:a05:6a00:2401:b0:4a8:909:1d01 with SMTP id z1-20020a056a00240100b004a809091d01mr20179154pfh.83.1638549986587; Fri, 03 Dec 2021 08:46:26 -0800 (PST) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:203:cd78:3a5f:d792:6177]) by smtp.gmail.com with ESMTPSA id h18sm4123149pfh.172.2021.12.03.08.46.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 08:46:26 -0800 (PST) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Sat, 4 Dec 2021 01:46:13 +0900 Message-Id: <20211203164619.1541033-2-hiroh@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211203164619.1541033-1-hiroh@chromium.org> References: <20211203164619.1541033-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/7] libcamera: base: semaphore: Apply clang thread safety annotation X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This annotates member functions and variables of Semaphore by clang thread safety annotations. Signed-off-by: Hirokazu Honda --- include/libcamera/base/semaphore.h | 10 +++++----- src/libcamera/base/semaphore.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/libcamera/base/semaphore.h b/include/libcamera/base/semaphore.h index c11e8dd1..f1052317 100644 --- a/include/libcamera/base/semaphore.h +++ b/include/libcamera/base/semaphore.h @@ -18,15 +18,15 @@ class Semaphore public: Semaphore(unsigned int n = 0); - unsigned int available(); - void acquire(unsigned int n = 1); - bool tryAcquire(unsigned int n = 1); - void release(unsigned int n = 1); + unsigned int available() LIBCAMERA_TSA_EXCLUDES(mutex_); + void acquire(unsigned int n = 1) LIBCAMERA_TSA_EXCLUDES(mutex_); + bool tryAcquire(unsigned int n = 1) LIBCAMERA_TSA_EXCLUDES(mutex_); + void release(unsigned int n = 1) LIBCAMERA_TSA_EXCLUDES(mutex_); private: Mutex mutex_; ConditionVariable cv_; - unsigned int available_; + unsigned int available_ LIBCAMERA_TSA_GUARDED_BY(mutex_); }; } /* namespace libcamera */ diff --git a/src/libcamera/base/semaphore.cpp b/src/libcamera/base/semaphore.cpp index 4fe30293..1e1c2efa 100644 --- a/src/libcamera/base/semaphore.cpp +++ b/src/libcamera/base/semaphore.cpp @@ -56,7 +56,7 @@ unsigned int Semaphore::available() void Semaphore::acquire(unsigned int n) { MutexLocker locker(mutex_); - cv_.wait(locker, [&] { return available_ >= n; }); + cv_.wait(locker, [&]() LIBCAMERA_TSA_REQUIRES(mutex_) { return available_ >= n; }); available_ -= n; } From patchwork Fri Dec 3 16:46:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 15015 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 51614BF415 for ; Fri, 3 Dec 2021 16:46:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A38B660839; Fri, 3 Dec 2021 17:46:32 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="btAo1BcM"; dkim-atps=neutral Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4BD3760822 for ; Fri, 3 Dec 2021 17:46:30 +0100 (CET) Received: by mail-pl1-x635.google.com with SMTP id y8so2520197plg.1 for ; Fri, 03 Dec 2021 08:46:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=w4rnq1G43kcabXi0+eiMWXx37SsnfadSaV/7HNh2lW0=; b=btAo1BcMbMj+RinFkMTr88KsEwPLFIf0Vv8Mh7oUoiSG9ayAzkN09MTXpZML4aylB+ ypOmnSuAuW1O/mDnkknj1lT+oJLtTHkkUptVMZdsGBH4KJVTCvE1rzkbg97zMgpDpacr EMJTuJ1Ppk+iy6+w+19O/q/Ay80A3HBcjJJ1U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=w4rnq1G43kcabXi0+eiMWXx37SsnfadSaV/7HNh2lW0=; b=vafoh5Px3X/+5Bcq4IhICwo+XeFTW1SDVlHyt5MQQsTvLmU8uTgEWDV+7+cDxarX4U eIJ61l+SzNhu5UY+gv09suseo1Q/NOEeQXcwStUMitoMYwnkd09ahRGdIdfLuu/vgAG7 X+ZkgPkFVNWF5id/mdzudtZf7vP2mEnXnFDTwqEsG0eNR45bV0B6uvtCZoYMhfZjL+Fw efjpJefuRRoDboUWbe1Rca4aT8tiZSv9YgpUdG413Htt9ODic7wtnDmCo+9yWxFBCpE2 P/0vsIdFkZhf1wFO7pMu6Sg3TTLI500cDoXn8gha1cmVsdFRT874E+orHea5rC2KsMA5 qmiw== X-Gm-Message-State: AOAM532nqzcTObxmj+Zwu12FLwLnmmOI/go2syktDhJrymevgc6M2zD2 pwwy0QNGHROwveNYKUx0FPZ6+Qyoijuk1A== X-Google-Smtp-Source: ABdhPJysUbbtNx4EPcXgpwaNS2CTGkU7ntO6GRhNWKzjlqS/lU8q/lt6ZfvQALPttB7TdWRhLhLCAw== X-Received: by 2002:a17:902:c3cc:b0:141:be17:405e with SMTP id j12-20020a170902c3cc00b00141be17405emr23932328plj.76.1638549988315; Fri, 03 Dec 2021 08:46:28 -0800 (PST) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:203:cd78:3a5f:d792:6177]) by smtp.gmail.com with ESMTPSA id h18sm4123149pfh.172.2021.12.03.08.46.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 08:46:27 -0800 (PST) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Sat, 4 Dec 2021 01:46:14 +0900 Message-Id: <20211203164619.1541033-3-hiroh@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211203164619.1541033-1-hiroh@chromium.org> References: <20211203164619.1541033-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/7] libcamera: base: thread: Protect exitCode by mutex in exit() X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This fixes the bug that Thread::exit() accesses data_->exitCode without acquiring a lock. Signed-off-by: Hirokazu Honda --- src/libcamera/base/thread.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libcamera/base/thread.cpp b/src/libcamera/base/thread.cpp index 6bda9d14..abd33a83 100644 --- a/src/libcamera/base/thread.cpp +++ b/src/libcamera/base/thread.cpp @@ -390,9 +390,11 @@ void Thread::finishThread() * * \context This function is \threadsafe. */ -void Thread::exit(int code) +void Thread::exitint code) { + data_->mutex_.lock(); data_->exitCode_ = code; + data_->mutex_.unlock(); data_->exit_.store(true, std::memory_order_release); EventDispatcher *dispatcher = data_->dispatcher_.load(std::memory_order_relaxed); From patchwork Fri Dec 3 16:46:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 15016 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 63F8DBF415 for ; Fri, 3 Dec 2021 16:46:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1938560822; Fri, 3 Dec 2021 17:46:35 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="FeSYt4Ow"; dkim-atps=neutral Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id ECEF360822 for ; Fri, 3 Dec 2021 17:46:31 +0100 (CET) Received: by mail-pj1-x102a.google.com with SMTP id iq11so2758065pjb.3 for ; Fri, 03 Dec 2021 08:46:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pI8V8gbQRxT9tr/AaPVKtqTwDKeOmbZ37IXXJs9oD0Q=; b=FeSYt4Ow1X9Hob9sGY/yqRYnwtSxaCDpkQwomurTOgT1kt8gxRiuN+Y8wtTgxnhqDC ro507TeUFglyjFJ4ed5LQsHhd259sYYcqksT7tRZOT106C59+lEyHoavQ7i8NPy1zC2d y437GbUMrcWBveq9JhciS/kI+pCmKJ9v8hB8Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pI8V8gbQRxT9tr/AaPVKtqTwDKeOmbZ37IXXJs9oD0Q=; b=7Q7LC9L8S8AuQR2kxcqzSpeydeUm8Itn9YKkvWiNbHI4dJ780sBOPCR/5K8c75P6jf kIas/4nBtANl0+kxKL8koKt+1ExKK7VIuspWWXlsDUiaAbXmTbRxOEYsZaL/ikekn+Z9 VrXkr2mT9QkPWEB57uUP6EqxVJkM7kuES15oZYHk4gq3dWEch6h80C4IvOQsMwv6cW9S pQxyY2InrUK7RkaoQAbMnMjMG1GG3EWWL9ljU0K8VpMXLqqAIk8uV6rLuO8lXergqCcE Rxtx6iXK1MBDlGQWoxw/4jR4Z87WjMoSf4dsGr9JtPkEc/jcr8iG/Y2ORgChPjp4xNBJ xXwg== X-Gm-Message-State: AOAM531T3ppjnbb81BzbR14N0f1zIEKq2L0hHQz7UwB7F7i76XUWBiUS 8OgnrCgjNaFGnqFLgLPh6Blb+EslAf2qRw== X-Google-Smtp-Source: ABdhPJx//5GFSsakAGfXOSSc3JZbZsrQlEePLvi8P/Zvl6EOvatiwLWeRB78I8d/Dkdl1sQuwwn0aQ== X-Received: by 2002:a17:902:904b:b0:143:73ff:eb7d with SMTP id w11-20020a170902904b00b0014373ffeb7dmr23451270plz.85.1638549989989; Fri, 03 Dec 2021 08:46:29 -0800 (PST) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:203:cd78:3a5f:d792:6177]) by smtp.gmail.com with ESMTPSA id h18sm4123149pfh.172.2021.12.03.08.46.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 08:46:29 -0800 (PST) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Sat, 4 Dec 2021 01:46:15 +0900 Message-Id: <20211203164619.1541033-4-hiroh@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211203164619.1541033-1-hiroh@chromium.org> References: <20211203164619.1541033-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/7] libcamera: base: thread: Apply clang thread safety annotation X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This annotates member variables of ThreadData by clang thread safety annotations. Signed-off-by: Hirokazu Honda --- src/libcamera/base/thread.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/libcamera/base/thread.cpp b/src/libcamera/base/thread.cpp index abd33a83..205f3d1b 100644 --- a/src/libcamera/base/thread.cpp +++ b/src/libcamera/base/thread.cpp @@ -151,7 +151,7 @@ private: friend class ThreadMain; Thread *thread_; - bool running_; + bool running_ LIBCAMERA_TSA_GUARDED_BY(mutex_); pid_t tid_; Mutex mutex_; @@ -160,7 +160,7 @@ private: ConditionVariable cv_; std::atomic exit_; - int exitCode_; + int exitCode_ LIBCAMERA_TSA_GUARDED_BY(mutex_); MessageQueue messages_; }; @@ -390,7 +390,7 @@ void Thread::finishThread() * * \context This function is \threadsafe. */ -void Thread::exitint code) +void Thread::exit(int code) { data_->mutex_.lock(); data_->exitCode_ = code; @@ -424,11 +424,19 @@ bool Thread::wait(utils::duration duration) { MutexLocker locker(data_->mutex_); - if (duration == utils::duration::max()) - data_->cv_.wait(locker, [&]() { return !data_->running_; }); - else - hasFinished = data_->cv_.wait_for(locker, duration, - [&]() { return !data_->running_; }); + if (duration == utils::duration::max()) { + data_->cv_.wait( + locker, + [&]() LIBCAMERA_TSA_REQUIRES(data_->mutex_) { + return !data_->running_; + }); + } else { + hasFinished = data_->cv_.wait_for( + locker, duration, + [&]() LIBCAMERA_TSA_REQUIRES(data_->mutex_) { + return !data_->running_; + }); + } } if (thread_.joinable()) From patchwork Fri Dec 3 16:46:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 15017 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id E5929C3250 for ; Fri, 3 Dec 2021 16:46:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 94ABE60866; Fri, 3 Dec 2021 17:46:35 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="imgryb0C"; dkim-atps=neutral Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7B7EE60832 for ; Fri, 3 Dec 2021 17:46:33 +0100 (CET) Received: by mail-pf1-x42a.google.com with SMTP id o4so3399354pfp.13 for ; Fri, 03 Dec 2021 08:46:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SOjwkxvaB3gTmgqq2Rgn4EIEGW+XBwNkwP7Cpqxju8U=; b=imgryb0C6UBerLH8Ofu2cPjRQOIPYp7tKpa+68QQwr0dUG92GNBtcHDKhfATMNCdoQ ZXcKScHJ5V8q7DZ+gE6z/QVB9vV7oHgWBQHClyU1iu2RhY3ANGqcv0LLzqqQP2Gz4cQ4 xD20T5VQJoHnL+flfD0G0Wi8/avo2aBVdYlgc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SOjwkxvaB3gTmgqq2Rgn4EIEGW+XBwNkwP7Cpqxju8U=; b=FolTucwphtqp9EAVseH4r+lpRs71kCLyGNFm0JaVRqNLI5Anh73oQ7vQZ3i8gPlOEg kYdOwi3MONv7Y/ExEMwwgGnfMTebbLnQt7bTtqnr/9yDINvjFjC8EbzHn90zdhg4BxPS J7LT2qYXGmiXr46veEWhSRqQHkMSd4qL/YM5e/90mtBjk1oGCoKODFqbCCJ2+KfSWiEm up4dFzWaZMfQ4HT4t+95lCmOt8DiS3c7eZZLaHTFxia6VR11wtJ9L+EgrAMIxeo48uSd 8FOyoxBnQaIzQbXpR9Fsn72WWqyF41f/FKFEtJGsreR2LNaLb78sMlKrIZJFC52a8B0X 6a4g== X-Gm-Message-State: AOAM530I5JgpjATZtO8Dpgay8xig2PdEB3jc000NEv9k/31S13xdod9i E1CWp4WP1BWuPk8j2v9qL7/Myg0MutB6Ig== X-Google-Smtp-Source: ABdhPJyis67JX/edsUfvdaj9esX/pPJI6VNKP8/w/iq3f97bKClA+v7K2GKPixlWMOJwwMhEP8KAnA== X-Received: by 2002:a63:6bc4:: with SMTP id g187mr5337417pgc.220.1638549991659; Fri, 03 Dec 2021 08:46:31 -0800 (PST) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:203:cd78:3a5f:d792:6177]) by smtp.gmail.com with ESMTPSA id h18sm4123149pfh.172.2021.12.03.08.46.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 08:46:31 -0800 (PST) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Sat, 4 Dec 2021 01:46:16 +0900 Message-Id: <20211203164619.1541033-5-hiroh@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211203164619.1541033-1-hiroh@chromium.org> References: <20211203164619.1541033-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 4/7] libcamera: camera_manager: Protect cameras_ by mutex in cleanup() X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This fixes the bug that camera_ is accessed without acquiring mutex_ in CameraManager::Private::cleanup(). Signed-off-by: Hirokazu Honda --- src/libcamera/camera_manager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp index 70d73822..4492edc3 100644 --- a/src/libcamera/camera_manager.cpp +++ b/src/libcamera/camera_manager.cpp @@ -178,7 +178,10 @@ void CameraManager::Private::cleanup() * process deletion requests from the thread's message queue as the event * loop is not in action here. */ + mutex_.lock(); cameras_.clear(); + mutex_.unlock(); + dispatchMessages(Message::Type::DeferredDelete); enumerator_.reset(nullptr); From patchwork Fri Dec 3 16:46:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 15018 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 685A7BF415 for ; Fri, 3 Dec 2021 16:46:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 15B7760832; Fri, 3 Dec 2021 17:46:38 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="JwDVWpJj"; dkim-atps=neutral Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2B30060832 for ; Fri, 3 Dec 2021 17:46:35 +0100 (CET) Received: by mail-pj1-x1034.google.com with SMTP id k6-20020a17090a7f0600b001ad9d73b20bso654396pjl.3 for ; Fri, 03 Dec 2021 08:46:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aaXWYeJ3wIyj4arkroVtv0cJnoJqlHwOboUzeCUjESo=; b=JwDVWpJjpbQNdHR8Z1n6g3bj8Zd/+wdklPbFvdfuYliBLy6Qzvo/Ixb6JgHgOCynAX HYFVRGo16hCmyNgmpiv4pk4KPCRYx+g6h+soJeQt6VopsMwLgalhDOCsjdvtebOj3kht dKVuGfIw1GX75qw3ZPUz7r+6hdCfjy9vgD3PU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aaXWYeJ3wIyj4arkroVtv0cJnoJqlHwOboUzeCUjESo=; b=k1cP0cJ+d5gS5BChGCDLcmEiFJlwAWYOm1BPVahPlc0oQYx/shN7p0eyRaVIbyO9gD UZU0zyPiZ1aSd3+4xeVECXfaa4RHdt9rTV3PrPbEOC30EVGrht+QT/LyFYzA8z8Xjj9y SZW4eXQG9n94H/pCARb5nzw6/dt+rbcmgxKDnmR22kWK0AJVSAN6iCjJ1x8qLFHh92K9 TW3OSQc0TzEk1Lmz4OoK501O/Q5fS1A3a8hbY7u9k2eF3YhwiJlPGO6h2YUuaPyIJ/zI g2PcmWrMwHPviNISFP3nlTvjYaohBi/zZkgSUJch14vj5FmPcOKXy6ztmOUYQVIllQKo +6cA== X-Gm-Message-State: AOAM533MJ8gV+O1cdTbs3AdpFFHIHXN6TjTyd93NkyuRC64stXoJuFuI r6F3yg4gS8Rhd3iZOdnjd+uQGgi8Gd/FNw== X-Google-Smtp-Source: ABdhPJwhYrWB0OnZbPCZQH3TwxJV0arqHtzCyWxG2SgBdlqpIJqjnx8elBD3vYVt9ySWBouNrkN7Hw== X-Received: by 2002:a17:90a:1913:: with SMTP id 19mr15350770pjg.174.1638549993474; Fri, 03 Dec 2021 08:46:33 -0800 (PST) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:203:cd78:3a5f:d792:6177]) by smtp.gmail.com with ESMTPSA id h18sm4123149pfh.172.2021.12.03.08.46.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 08:46:33 -0800 (PST) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Sat, 4 Dec 2021 01:46:17 +0900 Message-Id: <20211203164619.1541033-6-hiroh@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211203164619.1541033-1-hiroh@chromium.org> References: <20211203164619.1541033-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 5/7] libcamera: camera_manager: Apply clang thread safety annotation X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This annotates member functions and variables of CameraManager::Private by clang thread safety annotations. Signed-off-by: Hirokazu Honda --- src/libcamera/camera_manager.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp index 4492edc3..507f68f5 100644 --- a/src/libcamera/camera_manager.cpp +++ b/src/libcamera/camera_manager.cpp @@ -42,8 +42,8 @@ public: int start(); void addCamera(std::shared_ptr camera, - const std::vector &devnums); - void removeCamera(Camera *camera); + const std::vector &devnums) LIBCAMERA_TSA_EXCLUDES(mutex_); + void removeCamera(Camera *camera) LIBCAMERA_TSA_EXCLUDES(mutex_); /* * This mutex protects @@ -52,8 +52,8 @@ public: * - cameras_ and camerasByDevnum_ after initialization */ mutable Mutex mutex_; - std::vector> cameras_; - std::map> camerasByDevnum_; + std::vector> cameras_ LIBCAMERA_TSA_GUARDED_BY(mutex_); + std::map> camerasByDevnum_ LIBCAMERA_TSA_GUARDED_BY(mutex_); protected: void run() override; @@ -61,11 +61,11 @@ protected: private: int init(); void createPipelineHandlers(); - void cleanup(); + void cleanup() LIBCAMERA_TSA_EXCLUDES(mutex_); ConditionVariable cv_; - bool initialized_; - int status_; + bool initialized_ LIBCAMERA_TSA_GUARDED_BY(mutex_); + int status_ LIBCAMERA_TSA_GUARDED_BY(mutex_); std::unique_ptr enumerator_; @@ -87,7 +87,8 @@ int CameraManager::Private::start() { MutexLocker locker(mutex_); - cv_.wait(locker, [&] { return initialized_; }); + cv_.wait(locker, + [&]() LIBCAMERA_TSA_REQUIRES(mutex_) { return initialized_; }); status = status_; } From patchwork Fri Dec 3 16:46:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 15019 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 1550DC3250 for ; Fri, 3 Dec 2021 16:46:39 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B9B27607DE; Fri, 3 Dec 2021 17:46:38 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ke8+NzHz"; dkim-atps=neutral Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B887360832 for ; Fri, 3 Dec 2021 17:46:36 +0100 (CET) Received: by mail-pj1-x1029.google.com with SMTP id n15-20020a17090a160f00b001a75089daa3so5631321pja.1 for ; Fri, 03 Dec 2021 08:46:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JaMrsxLXuEEZtzL4x5CBJKy9cwdODa5T8VqnK8aUtUU=; b=ke8+NzHzsoGLQwq91uklPiglqgf32s2wqbJF8hlJwmQDEWU8lKdhn/5fxacdrOcWnt TTdcfwe1gBso8XFT9RHc7xFTkI9dlLztkHw8AghMmfATvPzW+eUQ93wyhG6vL3MsTf+p SAZ7EP3BVzSEYhBQAOIRTMYt/SSwUatV34jFY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JaMrsxLXuEEZtzL4x5CBJKy9cwdODa5T8VqnK8aUtUU=; b=6Ubq4WbTZcws3jRWAa5oVwORGAfu2rQI+pWn9Gbeb0UnCVaojFbzvRJl4HVd2c4iiE a1CdGE41Qh/TAj2XmfbRrJLWykL0YJHLCJZqCLdqCop9Aw+iJPhKghsY9ISwSXHJlkCt iZML4Eaarudt4rXhUs7E51QWMuqa+hq7CKz1xiCE+0LFyPwEjNKJSyhpCsy0lPUxDROF eN4lfZG/EGjQ5QXZSvVPXMHZHtqp/4P0WeXWCSG9PH+A0XXh2WeSBHDffYhX12TqwO/g i2LQy2jcrdY7bGjGaPwqmMrWKZL62ZeVXe3tvc8ZNCtnKJuP9WWXcLI7eM+bjugeBp3u g4Gg== X-Gm-Message-State: AOAM532M5LWLtrvpMeOD65p1ZuFogtzsgnsZqNwg2MEXWMFMOMoEclql I+B0ionpRMJ50NHXVFDxHsMMJ7Ks2k/QJQ== X-Google-Smtp-Source: ABdhPJwQBM2YApX62D2fA7o/YXEf9HVKGINIA8KQFEUwkw46Q0pd7bGbzGtB/JgwfDo5xLFA7SA6/w== X-Received: by 2002:a17:90b:fd5:: with SMTP id gd21mr15848909pjb.37.1638549995041; Fri, 03 Dec 2021 08:46:35 -0800 (PST) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:203:cd78:3a5f:d792:6177]) by smtp.gmail.com with ESMTPSA id h18sm4123149pfh.172.2021.12.03.08.46.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 08:46:34 -0800 (PST) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Sat, 4 Dec 2021 01:46:18 +0900 Message-Id: <20211203164619.1541033-7-hiroh@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211203164619.1541033-1-hiroh@chromium.org> References: <20211203164619.1541033-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 6/7] v4l2: v4l2_camera_proxy: Apply clang thread safety annotation X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This annotates member functions of V4L2CameraProxy by clang thread safety annotations. Signed-off-by: Hirokazu Honda --- src/v4l2/v4l2_camera_proxy.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/v4l2/v4l2_camera_proxy.h b/src/v4l2/v4l2_camera_proxy.h index fa0a49e0..993562ef 100644 --- a/src/v4l2/v4l2_camera_proxy.h +++ b/src/v4l2/v4l2_camera_proxy.h @@ -27,12 +27,14 @@ class V4L2CameraProxy public: V4L2CameraProxy(unsigned int index, std::shared_ptr camera); - int open(V4L2CameraFile *file); - void close(V4L2CameraFile *file); - void *mmap(void *addr, size_t length, int prot, int flags, off64_t offset); - int munmap(void *addr, size_t length); - - int ioctl(V4L2CameraFile *file, unsigned long request, void *arg); + int open(V4L2CameraFile *file) LIBCAMERA_TSA_EXCLUDES(proxyMutex_); + void close(V4L2CameraFile *file) LIBCAMERA_TSA_EXCLUDES(proxyMutex_); + void *mmap(void *addr, size_t length, int prot, int flags, off64_t offset) + LIBCAMERA_TSA_EXCLUDES(proxyMutex_); + int munmap(void *addr, size_t length) LIBCAMERA_TSA_EXCLUDES(proxyMutex_); + + int ioctl(V4L2CameraFile *file, unsigned long request, void *arg) + LIBCAMERA_TSA_EXCLUDES(proxyMutex_); private: bool validateBufferType(uint32_t type); From patchwork Fri Dec 3 16:46:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 15020 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 83B9CBF415 for ; Fri, 3 Dec 2021 16:46:41 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 396DB60868; Fri, 3 Dec 2021 17:46:41 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="dKS7Ycer"; dkim-atps=neutral Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 508B760862 for ; Fri, 3 Dec 2021 17:46:38 +0100 (CET) Received: by mail-pf1-x433.google.com with SMTP id z6so3428901pfe.7 for ; Fri, 03 Dec 2021 08:46:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8AjrLQa6KvevGIzZ2Uw7/ytvhbTojq+0pxD3Ib25aUw=; b=dKS7Ycer1TOUHoU2S6dY1xd4I8vgUEoKYWvPq4G4bWQcgKXxIppNoFeJSW9BNrUY+I GP38FyiB04MmoifR4wrRK2oK32Qdje2/a/rRUU1iznnAJl7Dmk/V6OQWAEkL2daXIYuI G07CaSqY26CWvUU8giTGCfifXi9UdxULr6mJc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8AjrLQa6KvevGIzZ2Uw7/ytvhbTojq+0pxD3Ib25aUw=; b=hGIqN/FuPqkNH5QCcvFI2IBGysN8YYfJdr5QutT8jt7nXtfNdjztvt9eb4rkWJYahV aBci/FGs19p2lu/TzjpdA+NI8VGiMVbPlLa/rCSR86zgmKLRjnfHNyCWCuKpx3NdBJTz c4R/kVG/K12/Z+ZX3Z4St13WlTq+knQXhKy22WrF7kTS8vQuwj31FhkIzWYZNZEvkAmb lc6GSyIbrYD0Ghb11F2ceNKqPEioaGmMQKftkpb5yjvC9KOw2Q8uTez1okWDzlv67Q22 axfhARQAs680xPkbfDTwgTZyS5cVIDtr71i5zNpPsUtJmltTuAp3L02k0DBIFBrjFa/T t2zw== X-Gm-Message-State: AOAM533U9+DMzEJ1XRE+GbJcFdVAKiQoF9d5E1b8tRPhOSmIO9U77A7W oKIr+m8c28gQWTSYPHyH2QPXtr9uiVPgFQ== X-Google-Smtp-Source: ABdhPJzj9rQDLkDu1KAuWSXZeIkWcG0qw9SKxh/KUpVO3RnIvrMS3b4cRhaxaXJE1JYtzgbnXq9iCQ== X-Received: by 2002:a63:f651:: with SMTP id u17mr5212534pgj.256.1638549996666; Fri, 03 Dec 2021 08:46:36 -0800 (PST) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:203:cd78:3a5f:d792:6177]) by smtp.gmail.com with ESMTPSA id h18sm4123149pfh.172.2021.12.03.08.46.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 08:46:36 -0800 (PST) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Sat, 4 Dec 2021 01:46:19 +0900 Message-Id: <20211203164619.1541033-8-hiroh@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211203164619.1541033-1-hiroh@chromium.org> References: <20211203164619.1541033-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 7/7] v4l2: v4l2_camera: Apply clang thread safety annotation X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This annotates member functions and variables of V4L2Camera by clang thread safety annotations. Signed-off-by: Hirokazu Honda --- src/v4l2/v4l2_camera.cpp | 5 ++--- src/v4l2/v4l2_camera.h | 14 ++++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/v4l2/v4l2_camera.cpp b/src/v4l2/v4l2_camera.cpp index 157ab94e..6d571953 100644 --- a/src/v4l2/v4l2_camera.cpp +++ b/src/v4l2/v4l2_camera.cpp @@ -71,11 +71,10 @@ std::vector V4L2Camera::completedBuffers() { std::vector v; - bufferLock_.lock(); + MutexLocker lock(bufferLock_); for (std::unique_ptr &metadata : completedBuffers_) v.push_back(*metadata.get()); completedBuffers_.clear(); - bufferLock_.unlock(); return v; } @@ -278,7 +277,7 @@ int V4L2Camera::qbuf(unsigned int index) void V4L2Camera::waitForBufferAvailable() { MutexLocker locker(bufferMutex_); - bufferCV_.wait(locker, [&] { + bufferCV_.wait(locker, [&]() LIBCAMERA_TSA_REQUIRES(bufferMutex_) { return bufferAvailableCount_ >= 1 || !isRunning_; }); if (isRunning_) diff --git a/src/v4l2/v4l2_camera.h b/src/v4l2/v4l2_camera.h index 9307d61d..0d5a8948 100644 --- a/src/v4l2/v4l2_camera.h +++ b/src/v4l2/v4l2_camera.h @@ -39,7 +39,7 @@ public: void bind(int efd); void unbind(); - std::vector completedBuffers(); + std::vector completedBuffers() LIBCAMERA_TSA_EXCLUDES(bufferLock_); int configure(libcamera::StreamConfiguration *streamConfigOut, const libcamera::Size &size, @@ -58,13 +58,14 @@ public: int qbuf(unsigned int index); - void waitForBufferAvailable(); - bool isBufferAvailable(); + void waitForBufferAvailable() LIBCAMERA_TSA_EXCLUDES(bufferMutex_); + bool isBufferAvailable() LIBCAMERA_TSA_EXCLUDES(bufferMutex_); bool isRunning(); private: - void requestComplete(libcamera::Request *request); + void requestComplete(libcamera::Request *request) + LIBCAMERA_TSA_EXCLUDES(bufferLock_); std::shared_ptr camera_; std::unique_ptr config_; @@ -77,11 +78,12 @@ private: std::vector> requestPool_; std::deque pendingRequests_; - std::deque> completedBuffers_; + std::deque> completedBuffers_ + LIBCAMERA_TSA_GUARDED_BY(bufferLock_); int efd_; libcamera::Mutex bufferMutex_; libcamera::ConditionVariable bufferCV_; - unsigned int bufferAvailableCount_; + unsigned int bufferAvailableCount_ LIBCAMERA_TSA_GUARDED_BY(bufferMutex_); };