[{"id":25547,"web_url":"https://patchwork.libcamera.org/comment/25547/","msgid":"<Y1aYmkRSivgeVwoq@pendragon.ideasonboard.com>","date":"2022-10-24T13:52:26","subject":"Re: [libcamera-devel] [PATCH 02/11] Adds missing thread-safety\n\tannotations, lack of which break the build.","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Nicholas,\n\nThank you for the patch.\n\nOn Mon, Oct 24, 2022 at 12:55:34AM -0500, Nicholas Roth via libcamera-devel wrote:\n> From: Nicholas Roth <nicholas@rothemail.net>\n> \n> ../src/ipa/raspberrypi/controller/metadata.h:108:31: error: mutex 'mutex_' is still held at the end of function [-Werror,-Wthread-safety-analysis]\n>         void lock() { mutex_.lock(); }\n>                                      ^\n> ../src/ipa/raspberrypi/controller/metadata.h:108:23: note: mutex acquired here\n>         void lock() { mutex_.lock(); }\n>                              ^\n> ../src/ipa/raspberrypi/controller/metadata.h:109:25: error: releasing mutex 'mutex_' that was not held [-Werror,-Wthread-safety-analysis]\n>         void unlock() { mutex_.unlock(); }\n>                                ^\n\nApart from the commit message issue raised by Kieran, the code change\nlooks good to me.\n\n> ---\n>  src/ipa/raspberrypi/controller/metadata.h | 8 +++++---\n>  1 file changed, 5 insertions(+), 3 deletions(-)\n> \n> diff --git a/src/ipa/raspberrypi/controller/metadata.h b/src/ipa/raspberrypi/controller/metadata.h\n> index 0f7ebfaf..870b6e26 100644\n> --- a/src/ipa/raspberrypi/controller/metadata.h\n> +++ b/src/ipa/raspberrypi/controller/metadata.h\n> @@ -13,9 +13,11 @@\n>  #include <mutex>\n>  #include <string>\n>  \n> +#include <libcamera/base/thread_annotations.h>\n> +\n>  namespace RPiController {\n>  \n> -class Metadata\n> +class LIBCAMERA_TSA_CAPABILITY(\"mutex\") Metadata\n>  {\n>  public:\n>  \tMetadata() = default;\n> @@ -103,8 +105,8 @@ public:\n>  \t * locks with the standard lock classes.\n>  \t * e.g. std::lock_guard<RPiController::Metadata> lock(metadata)\n>  \t */\n> -\tvoid lock() { mutex_.lock(); }\n> -\tvoid unlock() { mutex_.unlock(); }\n> +\tvoid lock() LIBCAMERA_TSA_ACQUIRE() { mutex_.lock(); }\n> +\tvoid unlock() LIBCAMERA_TSA_RELEASE() { mutex_.unlock(); }\n>  \n>  private:\n>  \tmutable std::mutex mutex_;","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 16265BD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 24 Oct 2022 13:52:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CDEF062F19;\n\tMon, 24 Oct 2022 15:52:52 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 821D362EC6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Oct 2022 15:52:51 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 13D3416C0;\n\tMon, 24 Oct 2022 15:52:51 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1666619572;\n\tbh=edFIbZva1YTK1q4Tljok0e1J0cL+Hllh3bDmiKcK+VE=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=LWXdqEpbvAlSOhg0xi+B8o6L8wr5l5vzVy5Vv5ijIA42XKbgFGaQtupXgn6tMjcLV\n\tPwU5V+yJxlShknyLgJwtfU/d00AroLP5w1QznuyDmGHT9bIMSyG4KaBV+UhP2cXpEf\n\t2l7d00zX690PcgMyzGy9ZrQEDWNV/Xzw1Ha8csLmbb48t4Gad77Cw5BRX197iHZ4f3\n\tAQPU+iNFiXqReuToqfidm8DCc2vpf66gyN/a+f8ygJMz0hNl7ry3pddCPiH1opmTb1\n\t58+P7irqm+BqPQOnlA8RELy1JUiVml8arHtwJKPOSy7V53VCfz1bKeXeDRJz3IDGOC\n\tg0a+1CLjzW7Ag==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1666619571;\n\tbh=edFIbZva1YTK1q4Tljok0e1J0cL+Hllh3bDmiKcK+VE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=RvAjWtLiAaIGLaSS2ar4NSCE0Df6JHQre0rXwh1aX+0cGd7twOnEI6UaFEPf9K9HB\n\tOm99JY14q84Qji4/Uxo2lZKbV2BSJNABNVcyb1pg55YPSjatu/qg08ZYG3hFyGe6m7\n\tnvsLpY5eEVssqu0ZBg2NfBfdU5PpdmVM6rNDb/TM="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"RvAjWtLi\"; dkim-atps=neutral","Date":"Mon, 24 Oct 2022 16:52:26 +0300","To":"Nicholas Roth via libcamera-devel <libcamera-devel@lists.libcamera.org>","Message-ID":"<Y1aYmkRSivgeVwoq@pendragon.ideasonboard.com>","References":"<20221024055543.116040-1-nicholas@rothemail.net>\n\t<20221024055543.116040-3-nicholas@rothemail.net>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20221024055543.116040-3-nicholas@rothemail.net>","Subject":"Re: [libcamera-devel] [PATCH 02/11] Adds missing thread-safety\n\tannotations, lack of which break the build.","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>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"nicholas@rothemail.net","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]