{"id":16397,"url":"https://patchwork.libcamera.org/api/1.1/patches/16397/?format=json","web_url":"https://patchwork.libcamera.org/patch/16397/","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":"<20220627164612.12049-1-laurent.pinchart@ideasonboard.com>","date":"2022-06-27T16:46:12","name":"[libcamera-devel] libcamera: base: thread: Prevent messages to thread without an event loop","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"4616e9405d004722c5ca5672a8ce6dab6b88e11c","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16397/mbox/","series":[{"id":3225,"url":"https://patchwork.libcamera.org/api/1.1/series/3225/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3225","date":"2022-06-27T16:46:12","name":"[libcamera-devel] libcamera: base: thread: Prevent messages to thread without an event loop","version":1,"mbox":"https://patchwork.libcamera.org/series/3225/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16397/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16397/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 F1982BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 27 Jun 2022 16:46:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5F74865635;\n\tMon, 27 Jun 2022 18:46:36 +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 2DC736059B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Jun 2022 18:46:35 +0200 (CEST)","from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7D21E1C82; \n\tMon, 27 Jun 2022 18:46:34 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1656348396;\n\tbh=kEXuZcrNu1463nMF65Rmg80XyvAMNcYNZxO+Ayh6+q4=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=hJNgQutFwqFYaUNgERIHzYM8NKfup7i1uaU/h1I0sYmi8MqqbHZLcMuiIMmXg6AmY\n\tF1Jzoeek3l5cEuz4GyYPZsNdlwLr9D+riTWQ36xMsUypxYlqPqK+a02u3dZxO+ZC+V\n\tCTAndVAOpCB6fDzWhybckUqyu3+3wrn9oHok0R9HMHkzVGiwV12FmXJ+V3rWuL2U0g\n\tDbhJtIfP1NHb3W0/ZVIzFqL+Q1VyzQVKUBU24hPawNIQ1VRYjcl5zMOLR9fEE5xQMh\n\tBN/4UY6ArJuoARH2oFpw6jxP3XBavu7gu8I/N3vRwmp0NQMtdxVazylpJMSY0DMVA6\n\txWD3MffudoWRA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1656348394;\n\tbh=kEXuZcrNu1463nMF65Rmg80XyvAMNcYNZxO+Ayh6+q4=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=u88VJz5LwNc+azfz57uAmS+ClNtv04oqfI+F2+EKKnEIktcNe+nIHgkFzoN+c21Fy\n\tTh7gXlmCpzyXdkl6Kpz4Xx+W6rE7lTvFKYJRiJMfRve/ocCOIVjZISt4aptDGKTIFL\n\tenXsdbUkfFGzVinV9qPxFnNahVu+XTNoyXP/tVdU="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"u88VJz5L\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 27 Jun 2022 19:46:12 +0300","Message-Id":"<20220627164612.12049-1-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.35.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] libcamera: base: thread: Prevent messages\n\tto thread without an event loop","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"A message posted to an object bound to a thread without an event loop\nwill never get delivered. This indicates a bug in the caller, and\nmaterializes in ways that can be hard to debug, such as a signal never\nbeing delivered. Add an assertion in Thread::postMessage() to catch this\nat the source.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/base/thread.cpp | 1 +\n 1 file changed, 1 insertion(+)\n\n\nbase-commit: 27cc0a6b58bcca32071cb6ab96e5ee79c75031e5","diff":"diff --git a/src/libcamera/base/thread.cpp b/src/libcamera/base/thread.cpp\nindex 6bda9d1462f5..6ead1d7c12d0 100644\n--- a/src/libcamera/base/thread.cpp\n+++ b/src/libcamera/base/thread.cpp\n@@ -530,6 +530,7 @@ void Thread::postMessage(std::unique_ptr<Message> msg, Object *receiver)\n \tmsg->receiver_ = receiver;\n \n \tASSERT(data_ == receiver->thread()->data_);\n+\tASSERT(data_ != mainThread.data_);\n \n \tMutexLocker locker(data_->messages_.mutex_);\n \tdata_->messages_.list_.push_back(std::move(msg));\n","prefixes":["libcamera-devel"]}