{"id":14842,"url":"https://patchwork.libcamera.org/api/1.1/patches/14842/?format=json","web_url":"https://patchwork.libcamera.org/patch/14842/","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":"<20211129114453.3186042-7-hiroh@chromium.org>","date":"2021-11-29T11:44:48","name":"[libcamera-devel,v2,06/11] android: camera_hal_manager: Add thread safety annotation","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"fd18079539402e2ceab096031f7cff3ff6db3c41","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/14842/mbox/","series":[{"id":2770,"url":"https://patchwork.libcamera.org/api/1.1/series/2770/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2770","date":"2021-11-29T11:44:42","name":"Introduce clang thread safety annotations","version":2,"mbox":"https://patchwork.libcamera.org/series/2770/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/14842/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/14842/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 B2752C324F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Nov 2021 11:45:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 63BD2605A0;\n\tMon, 29 Nov 2021 12:45:15 +0100 (CET)","from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com\n\t[IPv6:2607:f8b0:4864:20::102c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 01CF2605A4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Nov 2021 12:45:12 +0100 (CET)","by mail-pj1-x102c.google.com with SMTP id gt5so12528501pjb.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Nov 2021 03:45:11 -0800 (PST)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:f254:cda9:46e8:17b7])\n\tby smtp.gmail.com with ESMTPSA id\n\thg4sm17951966pjb.1.2021.11.29.03.45.08\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 29 Nov 2021 03:45:09 -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=\"oAC0A7mX\"; 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=QyJp1wo8X/LrCsHfnNuW1F6S94xFr9aQXVRNt3MnHYY=;\n\tb=oAC0A7mXC9KmkaIKs1jhcacG/G7wD3TOSj3wCZcsoXgkVPcCllNmxOOnHzlLSA3bou\n\twix0PcpRflq/C1gT8Qc2nQ/SwogoB5eQBNHu+a0XP3YE9u0k17C7Gb4yghJvZKvub6Mr\n\taZmbQUSiblHP2laVaoSFIzGyqR9i64jdFR0hM=","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=QyJp1wo8X/LrCsHfnNuW1F6S94xFr9aQXVRNt3MnHYY=;\n\tb=C+wNjLnwCncw4mM1PGl+Ij/UWB0//Hz3C9Qgx4Lv/wqozMsERgO3cCaYhFWiQXwXAY\n\tTM+Ck6wOyz9K8JIMjzYFqbh/TeU6RLcdIYxmRWnzobQdCBJ2dwB/JhiCnNfmB+fChoyV\n\tvUqHYMcCHrCqnShfSI4ObWrcDkOafC+SaiXmGawU359Psdany065K404kxvsXBt3IEmy\n\tdAEDtK3nzyM9BsusPXL6SSfE9/v97+UWWDayuxCxSa+RRKyjYh9lHzvWa/5yOh0zMVy/\n\ty5sH/1y4vFYqyYhNECNxWh4JIHCJnAg/nF648UaKvLPELx7T5X2tChSUN1ecUeyO9GSd\n\t/I+g==","X-Gm-Message-State":"AOAM532xTlLwWSkEt7ghZIbyfAu0EkctfgRf/1YLq6tgXyLbTgYvijvX\n\tVn/iLHcC1zvFyS2TpyAyj6B9ZtLt4MwTWA==","X-Google-Smtp-Source":"ABdhPJzsQM1ti9ua2+qlLmRwvZ/pQ3FAYe63dM3/A8w4BVq1msp0aw0XbDGbDTAzpRvhpSEqe7m12Q==","X-Received":"by 2002:a17:902:db01:b0:141:ea12:2176 with SMTP id\n\tm1-20020a170902db0100b00141ea122176mr60157409plx.44.1638186310286; \n\tMon, 29 Nov 2021 03:45:10 -0800 (PST)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 29 Nov 2021 20:44:48 +0900","Message-Id":"<20211129114453.3186042-7-hiroh@chromium.org>","X-Mailer":"git-send-email 2.34.0.rc2.393.gf8c9666880-goog","In-Reply-To":"<20211129114453.3186042-1-hiroh@chromium.org>","References":"<20211129114453.3186042-1-hiroh@chromium.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 06/11] android: camera_hal_manager: 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 CameraHalManager.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n src/android/camera_hal_manager.h | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)","diff":"diff --git a/src/android/camera_hal_manager.h b/src/android/camera_hal_manager.h\nindex c07684a1..5395d419 100644\n--- a/src/android/camera_hal_manager.h\n+++ b/src/android/camera_hal_manager.h\n@@ -8,7 +8,6 @@\n #pragma once\n \n #include <map>\n-#include <mutex>\n #include <stddef.h>\n #include <tuple>\n #include <vector>\n@@ -18,7 +17,8 @@\n #include <system/camera_metadata.h>\n \n #include <libcamera/base/class.h>\n-#include <libcamera/base/thread.h>\n+#include <libcamera/base/mutex.h>\n+#include <libcamera/base/thread_annotations.h>\n \n #include <libcamera/camera_manager.h>\n \n@@ -54,14 +54,14 @@ private:\n \tvoid cameraAdded(std::shared_ptr<libcamera::Camera> cam);\n \tvoid cameraRemoved(std::shared_ptr<libcamera::Camera> cam);\n \n-\tCameraDevice *cameraDeviceFromHalId(unsigned int id);\n+\tCameraDevice *cameraDeviceFromHalId(unsigned int id) LIBCAMERA_TSA_REQUIRES(mutex_);\n \n \tstd::unique_ptr<libcamera::CameraManager> cameraManager_;\n \tCameraHalConfig halConfig_;\n \n \tconst camera_module_callbacks_t *callbacks_;\n-\tstd::vector<std::unique_ptr<CameraDevice>> cameras_;\n-\tstd::map<std::string, unsigned int> cameraIdsMap_;\n+\tstd::vector<std::unique_ptr<CameraDevice>> cameras_ LIBCAMERA_TSA_GUARDED_BY(mutex_);\n+\tstd::map<std::string, unsigned int> cameraIdsMap_ LIBCAMERA_TSA_GUARDED_BY(mutex_);\n \tlibcamera::Mutex mutex_;\n \n \tunsigned int numInternalCameras_;\n","prefixes":["libcamera-devel","v2","06/11"]}