Patch Detail
Show a patch.
GET /api/1.1/patches/19424/?format=api
{ "id": 19424, "url": "https://patchwork.libcamera.org/api/1.1/patches/19424/?format=api", "web_url": "https://patchwork.libcamera.org/patch/19424/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20240121035948.4226-4-laurent.pinchart@ideasonboard.com>", "date": "2024-01-21T03:59:39", "name": "[libcamera-devel,03/12] test: object-delete: Test deferred delete just before thread stops", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "7a0892cfab30bde7f85533907f2bbc8c3bef223f", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/19424/mbox/", "series": [ { "id": 4149, "url": "https://patchwork.libcamera.org/api/1.1/series/4149/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4149", "date": "2024-01-21T03:59:36", "name": "libcamera: Hardening against thread race conditions", "version": 1, "mbox": "https://patchwork.libcamera.org/series/4149/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/19424/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/19424/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 0FD44C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 21 Jan 2024 03:59:54 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B76C76294B;\n\tSun, 21 Jan 2024 04:59:53 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3A173628E9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 21 Jan 2024 04:59:50 +0100 (CET)", "from pendragon.ideasonboard.com (89-27-53-110.bb.dnainternet.fi\n\t[89.27.53.110])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D26D81574;\n\tSun, 21 Jan 2024 04:58:37 +0100 (CET)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1705809593;\n\tbh=4/6ICExn9z3UFsYl6U2WMNHXAzdh7EjXq0WmhmVa7xc=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=K5Z2hzgT84sAqHn+44SK9jkoja48Jp7WFCUjwoc9dDEKsiTlmH/A658tryS7ZWnwA\n\tFERUopbGIQzh8aeSASJaGaLv+UxpHkBNXf/js+RGtldeWgQ445IP9WKBb5UrtXwG30\n\tQBkot7qKSAUTzmfbQR0hPkIDXcnTzwW/jq3w/ms/8rtMqrbKS4A8iSLVC9nRDI86RK\n\tTojk1OA2kxraQylzr34hvF1i0KOzPHOskGD+kIgSc5om9e+f2aGttwtvfKaGh1ezF/\n\t3r/JkQVEsFBdGVlMvuNATBTYbLM4I1bsWXe985ATxu9sJu2k+/uDSjCrHOWmCyaHRM\n\t0lATzuu0ozeow==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1705809518;\n\tbh=4/6ICExn9z3UFsYl6U2WMNHXAzdh7EjXq0WmhmVa7xc=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=FIE6cEmdXLpQpjLMDF7ShALP9DJGwvr7J0Tj4xlPDS2L7r6uEBSsQ1Zs8g7o9MKNV\n\trtDmIMritcRRXLIp6yoPy3kY18zj26Fqz/aMjeGYyL0Z+w8cQfqLD1pmfNQDSxZAUE\n\thLhgc9EaGZdN1FIo5sFQIOfnvp07QJUF61wMz0j0=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"FIE6cEmd\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sun, 21 Jan 2024 05:59:39 +0200", "Message-ID": "<20240121035948.4226-4-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20240121035948.4226-1-laurent.pinchart@ideasonboard.com>", "References": "<20240121035948.4226-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 03/12] test: object-delete: Test deferred\n\tdelete just before thread stops", "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": "The Object::deleterLater() function is expected to not race with\nstopping the thread the object is bound to. Add a test for this.\n\nThe test currently fails, demonstrating a bug in libcamera.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n test/object-delete.cpp | 30 +++++++++++++++++++++++++-----\n 1 file changed, 25 insertions(+), 5 deletions(-)", "diff": "diff --git a/test/object-delete.cpp b/test/object-delete.cpp\nindex eabefe935974..80b7dc41cd37 100644\n--- a/test/object-delete.cpp\n+++ b/test/object-delete.cpp\n@@ -33,10 +33,10 @@ public:\n \tunsigned int *deleteCount_;\n };\n \n-class NewThread : public Thread\n+class DeleterThread : public Thread\n {\n public:\n-\tNewThread(Object *obj)\n+\tDeleterThread(Object *obj)\n \t\t: object_(obj)\n \t{\n \t}\n@@ -63,9 +63,9 @@ protected:\n \t\tunsigned int count = 0;\n \t\tTestObject *obj = new TestObject(&count);\n \n-\t\tNewThread thread(obj);\n-\t\tthread.start();\n-\t\tthread.wait();\n+\t\tDeleterThread delThread(obj);\n+\t\tdelThread.start();\n+\t\tdelThread.wait();\n \n \t\tThread::current()->dispatchMessages(Message::Type::DeferredDelete);\n \n@@ -89,6 +89,26 @@ protected:\n \t\t\treturn TestFail;\n \t\t}\n \n+\t\t/*\n+\t\t * Test that deleteLater() works properly when called just\n+\t\t * before the object's thread exits.\n+\t\t */\n+\t\tThread boundThread;\n+\t\tboundThread.start();\n+\n+\t\tcount = 0;\n+\t\tobj = new TestObject(&count);\n+\t\tobj->moveToThread(&boundThread);\n+\n+\t\tobj->deleteLater();\n+\t\tboundThread.exit();\n+\t\tboundThread.wait();\n+\n+\t\tif (count != 1) {\n+\t\t\tcout << \"Object deletion right before thread exit failed (\" << count << \")\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n \t\treturn TestPass;\n \t}\n };\n", "prefixes": [ "libcamera-devel", "03/12" ] }