{"id":22657,"url":"https://patchwork.libcamera.org/api/patches/22657/?format=json","web_url":"https://patchwork.libcamera.org/patch/22657/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20250128130308.509297-1-pobrn@protonmail.com>","date":"2025-01-28T13:03:10","name":"[RFC,v1] libcamera: thread: Use `acquire` memo. when reading event dispatcher","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"85eb758ce3ab4c9a18b04f774da0e23a2be88905","submitter":{"id":133,"url":"https://patchwork.libcamera.org/api/people/133/?format=json","name":"Pőcze Barnabás","email":"pobrn@protonmail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/22657/mbox/","series":[{"id":4975,"url":"https://patchwork.libcamera.org/api/series/4975/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4975","date":"2025-01-28T13:03:10","name":"[RFC,v1] libcamera: thread: Use `acquire` memo. when reading event dispatcher","version":1,"mbox":"https://patchwork.libcamera.org/series/4975/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/22657/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/22657/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 8EACABDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 28 Jan 2025 13:03:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 958C56855D;\n\tTue, 28 Jan 2025 14:03:17 +0100 (CET)","from mail-4316.protonmail.ch (mail-4316.protonmail.ch\n\t[185.70.43.16])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DCF7868546\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Jan 2025 14:03:15 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=protonmail.com header.i=@protonmail.com\n\theader.b=\"QkcKbcmx\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;\n\ts=protonmail3; t=1738069395; x=1738328595;\n\tbh=tyJv51uYcYf3+b0VTofQMOkVCt1d8dKYlqOV1oiZmjA=;\n\th=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date:\n\tSubject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector:\n\tList-Unsubscribe:List-Unsubscribe-Post;\n\tb=QkcKbcmxy7DvtnY3zlgoi9cC7bnyBo3jdqJjku8z3mmKDhsZ/9hBNzZgX8DCz1mJ0\n\t22rUPhyMUMs1sD3pweEB2Rs+KB0CRn2KiDS6ODvWIub5uug6mDRO3y4EJT2o43apfi\n\tLdtmMjZpZc4LjJM8PVtAd7Spcb0xhomnvpFo10CU2KSHI6dsL0ke1kntdhEX5W/IPn\n\txiOtAMVmFQVz17FfsjSgizfBuGuwuW1YFj9fKX4ZRRytPeRpFefC08BUoKhHpwBxRc\n\tHX9nafgJfw6pqpOvgdoBj/tonnxExDPlKWQ7eGEbKPvnxDrfVlBBBTQfi5WRoEYp++\n\tU/wND4sWoQz0g==","Date":"Tue, 28 Jan 2025 13:03:10 +0000","To":"libcamera-devel@lists.libcamera.org","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>","Subject":"[RFC PATCH v1] libcamera: thread: Use `acquire` memo. when reading\n\tevent dispatcher","Message-ID":"<20250128130308.509297-1-pobrn@protonmail.com>","Feedback-ID":"20568564:user:proton","X-Pm-Message-ID":"95df461bf91479b0230bf82ae1c54378ba1438ee","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","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":"Use `std::memory_order_acquire` everywhere the dispatcher is loaded\nto guarantee synchronization with the release-store that places\nthe pointer there.\n\nSigned-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n---\n src/libcamera/base/thread.cpp | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)","diff":"diff --git a/src/libcamera/base/thread.cpp b/src/libcamera/base/thread.cpp\nindex 319bfda9a..de60567f6 100644\n--- a/src/libcamera/base/thread.cpp\n+++ b/src/libcamera/base/thread.cpp\n@@ -238,7 +238,7 @@ Thread::Thread()\n \n Thread::~Thread()\n {\n-\tdelete data_->dispatcher_.load(std::memory_order_relaxed);\n+\tdelete data_->dispatcher_.load(std::memory_order_acquire);\n \tdelete data_;\n }\n \n@@ -371,7 +371,7 @@ void Thread::exit(int code)\n \tdata_->exitCode_ = code;\n \tdata_->exit_.store(true, std::memory_order_release);\n \n-\tEventDispatcher *dispatcher = data_->dispatcher_.load(std::memory_order_relaxed);\n+\tEventDispatcher *dispatcher = data_->dispatcher_.load(std::memory_order_acquire);\n \tif (!dispatcher)\n \t\treturn;\n \n","prefixes":["RFC","v1"]}