{"id":14937,"url":"https://patchwork.libcamera.org/api/1.1/patches/14937/?format=json","web_url":"https://patchwork.libcamera.org/patch/14937/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20211201070728.3114247-12-hiroh@chromium.org>","date":"2021-12-01T07:07:27","name":"[libcamera-devel,v4,11/12] android: camera_device: Add thread safety annotation","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"522e3de9e964027cb628ee6cdd057d6b98accc3d","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/1.1/people/63/?format=json","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/14937/mbox/","series":[{"id":2789,"url":"https://patchwork.libcamera.org/api/1.1/series/2789/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2789","date":"2021-12-01T07:07:16","name":"Introduce clang thread safety annotations","version":4,"mbox":"https://patchwork.libcamera.org/series/2789/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/14937/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/14937/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 3F91CBDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  1 Dec 2021 07:07:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E98B86072E;\n\tWed,  1 Dec 2021 08:07:57 +0100 (CET)","from mail-pf1-x436.google.com (mail-pf1-x436.google.com\n\t[IPv6:2607:f8b0:4864:20::436])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id ADE5660718\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  1 Dec 2021 08:07:55 +0100 (CET)","by mail-pf1-x436.google.com with SMTP id b68so23406980pfg.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Nov 2021 23:07:55 -0800 (PST)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:3892:a049:59ba:c772])\n\tby smtp.gmail.com with ESMTPSA id\n\tm10sm16598962pgv.75.2021.11.30.23.07.52\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 30 Nov 2021 23:07:53 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"iKaG2p6K\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=t1EdNmb2krgv/F9K2Ewspd25zRV1hwTxg1Jn4yjsZWU=;\n\tb=iKaG2p6KR6qwcJz68fTFOUccDIxNwBSEgBc7rupt1WO5I10C/cxvZqp/JMwcQq6pVU\n\twFl6/pX+TJPOi9E1RZX1P6kVt4/pXTBam/ppGekWZ37NphvPV0Yq1Jzl0wY5BzEFJT41\n\tA0XmGA3uI7cSQ3Tgl0wZdlvTDV9gwo/yRQ+x4=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=t1EdNmb2krgv/F9K2Ewspd25zRV1hwTxg1Jn4yjsZWU=;\n\tb=Vj8wFBfgRM2gPZeXDBI00kO87CNZ0yXR7YwJqPVNuJIOwxjjnw1or/RLei8bQIA0BS\n\tNL8ja2JM145lCAzbqJrOoq8tY5N80cnAn9HoG8BkqUERIRkM4KP5lcPqzaQ4HEzkxL1x\n\tX6GBGN+ZCnPIHV7jGr0XblH73PXGgotxW1vRKy+YjJxxtXWaB3sbelYXXBmZvjd5gQyN\n\tofcIWXhJxlQuSNdUgyE4b6HcODiFlB2gcLlu4p8A8KLhOtVxNmDkvVnxa+qHf5yEeBgo\n\tahnGoZt0MRfy9HUJ8sVa6zvwg2zwQ9BBVLYXPYS36SVDdiZdRauw1snEfA0pg8wSmdoe\n\tT0tQ==","X-Gm-Message-State":"AOAM531tX0N7fFla+1fAr3D5g1MdNssY1/iOI+pk0dYgQJJoEL7RuETG\n\tX8xSxiMlrxEhDaS4m0fJcQP7srmdXv3qEw==","X-Google-Smtp-Source":"ABdhPJzUsfihOASXc76xlhPYU4nYFFmaIQTqXcKBVpXCOn+G/1Kg1hcmhTEUWyozSaNofKNT5QzoAA==","X-Received":"by 2002:aa7:9e9c:0:b0:49f:c7cf:ff5 with SMTP id\n\tp28-20020aa79e9c000000b0049fc7cf0ff5mr4144964pfq.62.1638342474034; \n\tTue, 30 Nov 2021 23:07:54 -0800 (PST)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  1 Dec 2021 16:07:27 +0900","Message-Id":"<20211201070728.3114247-12-hiroh@chromium.org>","X-Mailer":"git-send-email 2.34.0.rc2.393.gf8c9666880-goog","In-Reply-To":"<20211201070728.3114247-1-hiroh@chromium.org>","References":"<20211201070728.3114247-1-hiroh@chromium.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 11/12] android: camera_device: Add\n\tthread safety annotation","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"This applies clang thread safety annotation to CameraDevice.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/android/camera_device.h | 14 ++++++++------\n 1 file changed, 8 insertions(+), 6 deletions(-)","diff":"diff --git a/src/android/camera_device.h b/src/android/camera_device.h\nindex a945f5de..e5d9cda2 100644\n--- a/src/android/camera_device.h\n+++ b/src/android/camera_device.h\n@@ -82,7 +82,7 @@ private:\n \t\tRunning,\n \t};\n \n-\tvoid stop();\n+\tvoid stop() LIBCAMERA_TSA_EXCLUDES(stateMutex_);\n \n \tstd::unique_ptr<libcamera::FrameBuffer>\n \tcreateFrameBuffer(const buffer_handle_t camera3buffer,\n@@ -94,8 +94,9 @@ private:\n \tvoid notifyError(uint32_t frameNumber, camera3_stream_t *stream,\n \t\t\t camera3_error_msg_code code) const;\n \tint processControls(Camera3RequestDescriptor *descriptor);\n-\tvoid completeDescriptor(Camera3RequestDescriptor *descriptor);\n-\tvoid sendCaptureResults();\n+\tvoid completeDescriptor(Camera3RequestDescriptor *descriptor)\n+\t\tLIBCAMERA_TSA_EXCLUDES(descriptorsMutex_);\n+\tvoid sendCaptureResults() LIBCAMERA_TSA_REQUIRES(descriptorsMutex_);\n \tvoid setBufferStatus(Camera3RequestDescriptor::StreamBuffer &buffer,\n \t\t\t     Camera3RequestDescriptor::Status status);\n \tstd::unique_ptr<CameraMetadata> getResultMetadata(\n@@ -107,7 +108,7 @@ private:\n \tCameraWorker worker_;\n \n \tlibcamera::Mutex stateMutex_; /* Protects access to the camera state. */\n-\tState state_;\n+\tState state_ LIBCAMERA_TSA_GUARDED_BY(stateMutex_);\n \n \tstd::shared_ptr<libcamera::Camera> camera_;\n \tstd::unique_ptr<libcamera::CameraConfiguration> config_;\n@@ -118,8 +119,9 @@ private:\n \n \tstd::vector<CameraStream> streams_;\n \n-\tlibcamera::Mutex descriptorsMutex_; /* Protects descriptors_. */\n-\tstd::queue<std::unique_ptr<Camera3RequestDescriptor>> descriptors_;\n+\tlibcamera::Mutex descriptorsMutex_ LIBCAMERA_TSA_ACQUIRED_AFTER(stateMutex_);\n+\tstd::queue<std::unique_ptr<Camera3RequestDescriptor>> descriptors_\n+\t\tLIBCAMERA_TSA_GUARDED_BY(descriptorsMutex_);\n \n \tstd::string maker_;\n \tstd::string model_;\n","prefixes":["libcamera-devel","v4","11/12"]}