{"id":2382,"url":"https://patchwork.libcamera.org/api/patches/2382/?format=json","web_url":"https://patchwork.libcamera.org/patch/2382/","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":"<20191127084909.10612-4-laurent.pinchart@ideasonboard.com>","date":"2019-11-27T08:49:08","name":"[libcamera-devel,4/5] libcamera: object: Document danger of deleting object from other thread","commit_ref":"7df177fd889624c4b149ba2ecabb4969ad8c2bee","pull_url":null,"state":"accepted","archived":false,"hash":"8a07882b329c161d322727103bf1fc253bde946d","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2382/mbox/","series":[{"id":580,"url":"https://patchwork.libcamera.org/api/series/580/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=580","date":"2019-11-27T08:49:05","name":"[libcamera-devel,1/5] test: message: Fix message handling in MessageReceiver","version":1,"mbox":"https://patchwork.libcamera.org/series/580/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2382/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2382/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["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 B51D06136B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Nov 2019 09:49:27 +0100 (CET)","from pendragon.tok.corp.google.com (unknown [104.132.253.101])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B7044A4B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Nov 2019 09:49:26 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1574844567;\n\tbh=X15X8SXF65v7Cq9Gi4Wh3gw23f0cVIhwEcOEFKzQuM4=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=uL4853olEttDQthx8keJxYBG3jO06AHUHJbegiQyQSci4h/E+QVdOgOlEyUUIb2LV\n\t8dipTLyOX3arGX0ajkYcpqWI4u0+b4y11b5363QuaK4l+QBrygU8yIr6woWW3EvkFO\n\tb9Og15dFKr0YgBAN8Ap6GGYtRJPiYoWZgq+2UpZM=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 27 Nov 2019 10:49:08 +0200","Message-Id":"<20191127084909.10612-4-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.23.0","In-Reply-To":"<20191127084909.10612-1-laurent.pinchart@ideasonboard.com>","References":"<20191127084909.10612-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 4/5] libcamera: object: Document danger of\n\tdeleting object from other thread","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>","X-List-Received-Date":"Wed, 27 Nov 2019 08:49:28 -0000"},"content":"Object instances receive messages dispatched from the event loop of the\nthread they belong to. Deleting an object from a different thread is\nthus dangerous, unless the caller ensures that no message delivery is in\nprogress. Document this in the Object class documentation.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/object.cpp | 4 ++++\n 1 file changed, 4 insertions(+)","diff":"diff --git a/src/libcamera/object.cpp b/src/libcamera/object.cpp\nindex 1f787271f782..e76faf48b8ed 100644\n--- a/src/libcamera/object.cpp\n+++ b/src/libcamera/object.cpp\n@@ -40,6 +40,10 @@ LOG_DEFINE_CATEGORY(Object)\n  * implementing easy message passing between threads by inheriting from the\n  * Object class.\n  *\n+ * Deleting an object from a thread other than the one the object is bound to is\n+ * unsafe, unless the caller ensures that the object isn't processing any\n+ * message concurrently.\n+ *\n  * Object slots connected to signals will also run in the context of the\n  * object's thread, regardless of whether the signal is emitted in the same or\n  * in another thread.\n","prefixes":["libcamera-devel","4/5"]}