Show a patch.

GET /api/patches/9121/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 9121,
    "url": "https://patchwork.libcamera.org/api/patches/9121/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/9121/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20200731181410.99892-4-email@uajain.com>",
    "date": "2020-07-31T18:14:18",
    "name": "[libcamera-devel,v4,3/4] tests: Add a test case for the Object::deleteLater() API, to verify",
    "commit_ref": "9c5f82139689a0133f8c253100762511af2e3a6e",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "c89a963be272a87bfbd10ee41fb825a1eb710dd8",
    "submitter": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/people/1/?format=api",
        "name": "Umang Jain",
        "email": "email@uajain.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/9121/mbox/",
    "series": [
        {
            "id": 1172,
            "url": "https://patchwork.libcamera.org/api/series/1172/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1172",
            "date": "2020-07-31T18:14:13",
            "name": "libcamera: object: Add deleteLater() support",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/1172/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/9121/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/9121/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 2F4F9BD86F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 31 Jul 2020 18:14:23 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F0507616FF;\n\tFri, 31 Jul 2020 20:14:22 +0200 (CEST)",
            "from o1.f.az.sendgrid.net (o1.f.az.sendgrid.net [208.117.55.132])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D04E7611A2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 31 Jul 2020 20:14:19 +0200 (CEST)",
            "by filterdrecv-p3mdw1-canary-6c6ff5ff56-ngzws with SMTP id\n\tfilterdrecv-p3mdw1-canary-6c6ff5ff56-ngzws-19-5F245F7A-2B\n\t2020-07-31 18:14:18.684604995 +0000 UTC m=+176754.616199453",
            "from mail.uajain.com (unknown)\n\tby ismtpd0004p1maa1.sendgrid.net (SG) with ESMTP\n\tid 9Pe3IcQ-QciL4abFBGXmbw Fri, 31 Jul 2020 18:14:18.296 +0000 (UTC)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=uajain.com header.i=@uajain.com\n\theader.b=\"HiR6M8Hg\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=uajain.com;\n\th=from:subject:in-reply-to:references:mime-version:to:cc:\n\tcontent-transfer-encoding:content-type;\n\ts=s1; bh=tliDj6tjrNI3aLDqSMiIZntu529xthAawTbKFHUaav4=;\n\tb=HiR6M8HgbMT7x+2e5eCyByFls3nWGYSP/P0K+UBdZUiBjiT+B0KsyJ/NFHSKpHyoRCc8\n\txgYDJhtusorbKnqRTZOuoR6k1K4eIac3KeKb2XuCnNNSsl+1vx6P0HNMghnsB/OrSQHevp\n\tfB3S19Nf92bT5s7IuK/nM2dNnYV+b8ETA=",
        "From": "Umang Jain <email@uajain.com>",
        "Date": "Fri, 31 Jul 2020 18:14:18 +0000 (UTC)",
        "Message-Id": "<20200731181410.99892-4-email@uajain.com>",
        "In-Reply-To": "<20200731181410.99892-1-email@uajain.com>",
        "References": "<20200731181410.99892-1-email@uajain.com>",
        "Mime-Version": "1.0",
        "X-SG-EID": "1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPcGYE5Iq+t2q0vZlJgodhIO7E4tCmj/R8GiO7znSV98Wx6NqD26y/vMGp0bm+HFnOnXp3b40OX0xIhBt9Xd8DLzOlb1OTvR86TGb2GbpgUxMQ6Bs0oV6a+H7+669T9knL/S3bQQTreuv4jAPGGfk6pRKQ57K4zaXnoamZbCFPiIBiLurGt2hAU1CiF0j4Aox4S9ZnnuYHJisa9qteZgM8HNYyLcAkz4IMW3Id1Vmk9UJw=",
        "To": "libcamera-devel@lists.libcamera.org",
        "Subject": "[libcamera-devel] [PATCH v4 3/4] tests: Add a test case for the\n\tObject::deleteLater() API, to verify",
        "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>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "- the object is deleted from the correct thread\n- multiple deleteLater() calls delete the object once only\n\nSigned-off-by: Umang Jain <email@uajain.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n test/meson.build       |  1 +\n test/object-delete.cpp | 97 ++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 98 insertions(+)\n create mode 100644 test/object-delete.cpp",
    "diff": "diff --git a/test/meson.build b/test/meson.build\nindex f41d6e7..f5aa144 100644\n--- a/test/meson.build\n+++ b/test/meson.build\n@@ -34,6 +34,7 @@ internal_tests = [\n     ['hotplug-cameras',                 'hotplug-cameras.cpp'],\n     ['message',                         'message.cpp'],\n     ['object',                          'object.cpp'],\n+    ['object-delete',                   'object-delete.cpp'],\n     ['object-invoke',                   'object-invoke.cpp'],\n     ['pixel-format',                    'pixel-format.cpp'],\n     ['signal-threads',                  'signal-threads.cpp'],\ndiff --git a/test/object-delete.cpp b/test/object-delete.cpp\nnew file mode 100644\nindex 0000000..a1a6f5c\n--- /dev/null\n+++ b/test/object-delete.cpp\n@@ -0,0 +1,97 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2020, Google Inc.\n+ *\n+ * object.cpp - Object deletion tests\n+ */\n+\n+#include <iostream>\n+\n+#include <libcamera/object.h>\n+\n+#include \"libcamera/internal/thread.h\"\n+\n+#include \"test.h\"\n+\n+using namespace std;\n+using namespace libcamera;\n+\n+class TestObject : public Object\n+{\n+public:\n+\tTestObject(unsigned int *count)\n+\t\t: deleteCount_(count)\n+\t{\n+\t}\n+\n+\t~TestObject()\n+\t{\n+\t\t/* Count the deletions from the correct thread. */\n+\t\tif (thread() == Thread::current())\n+\t\t\t(*deleteCount_)++;\n+\t}\n+\n+\tunsigned int *deleteCount_;\n+};\n+\n+class NewThread : public Thread\n+{\n+public:\n+\tNewThread(Object *obj)\n+\t\t: object_(obj)\n+\t{\n+\t}\n+\n+protected:\n+\tvoid run()\n+\t{\n+\t\tobject_->deleteLater();\n+\t}\n+\n+private:\n+\tObject *object_;\n+};\n+\n+class ObjectDeleteTest : public Test\n+{\n+protected:\n+\tint run()\n+\t{\n+\t\t/*\n+\t\t * Test that deferred deletion is executed from the object's\n+\t\t * thread, not the caller's thread.\n+\t\t */\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+\n+\t\tThread::current()->dispatchMessages(Message::Type::DeferredDelete);\n+\n+\t\tif (count != 1) {\n+\t\t\tcout << \"Failed to dispatch DeferredDelete (\" << count << \")\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/*\n+\t\t * Test that multiple calls to deleteLater() delete the object\n+\t\t * once only.\n+\t\t */\n+\t\tcount = 0;\n+\t\tobj = new TestObject(&count);\n+\t\tobj->deleteLater();\n+\t\tobj->deleteLater();\n+\n+\t\tThread::current()->dispatchMessages(Message::Type::DeferredDelete);\n+\t\tif (count != 1) {\n+\t\t\tcout << \"Multiple deleteLater() failed (\" << count << \")\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\treturn TestPass;\n+\t}\n+};\n+\n+TEST_REGISTER(ObjectDeleteTest)\n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "3/4"
    ]
}