Show a patch.

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

{
    "id": 2279,
    "url": "https://patchwork.libcamera.org/api/patches/2279/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/2279/",
    "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": "<20191028104913.14985-7-laurent.pinchart@ideasonboard.com>",
    "date": "2019-10-28T10:49:10",
    "name": "[libcamera-devel,v2,6/9] libcamera: object: Use bound method activePack() for invokeMethod()",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "1a58a57d6c3492be2328e57c488efca62bf9bb99",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/2279/mbox/",
    "series": [
        {
            "id": 562,
            "url": "https://patchwork.libcamera.org/api/series/562/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=562",
            "date": "2019-10-28T10:49:04",
            "name": "Add support for blocking method invocation",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/562/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/2279/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/2279/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 C58C46017E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 28 Oct 2019 11:49:26 +0100 (CET)",
            "from pendragon.ideasonboard.com (unknown [91.217.168.176])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 79244325\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 28 Oct 2019 11:49:26 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1572259766;\n\tbh=QnAw0eeLXgkW37YTFFzpftiqmtMObRRfG6mrQNrpA2c=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=Dn04odB7ZbEwDepxlA6GcaaSJRrTtHyyUk2Lo19x/1eYllm5nxcoo3h5ZUCxgslE0\n\tLpNAljXHuZ7S+plY+2x9aPTbDtSQ/EDMuX2Lmcdg2dOtrK2FPufMha755zp1/Y+BZD\n\tsSLJvuz7v+7jlsuxI4l/+gCGkGuvitiOYYhbs3tk=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 28 Oct 2019 12:49:10 +0200",
        "Message-Id": "<20191028104913.14985-7-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.23.0",
        "In-Reply-To": "<20191028104913.14985-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20191028104913.14985-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 6/9] libcamera: object: Use bound\n\tmethod activePack() for invokeMethod()",
        "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": "Mon, 28 Oct 2019 10:49:28 -0000"
    },
    "content": "The BoundMethodBase::activatePack() and the internal\nObject::invokeMethod() are duplicate implementation of the same\nmechanism. Use the former to replace the latter.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/bound_method.h | 4 ++--\n include/libcamera/object.h       | 8 ++++----\n src/libcamera/bound_method.cpp   | 6 +++---\n src/libcamera/object.cpp         | 7 -------\n 4 files changed, 9 insertions(+), 16 deletions(-)",
    "diff": "diff --git a/include/libcamera/bound_method.h b/include/libcamera/bound_method.h\nindex 06c5a3b12305..bdeb5469cda3 100644\n--- a/include/libcamera/bound_method.h\n+++ b/include/libcamera/bound_method.h\n@@ -37,7 +37,7 @@ public:\n \tObject *object() const { return object_; }\n \tConnectionType connectionType() const { return connectionType_; }\n \n-\tvoid activatePack(void *pack);\n+\tvoid activatePack(void *pack, bool deleteMethod);\n \tvirtual void invokePack(void *pack) = 0;\n \n protected:\n@@ -109,7 +109,7 @@ public:\n \tvoid activate(Args... args)\n \t{\n \t\tif (this->object_)\n-\t\t\tBoundMethodBase::activatePack(new PackType{ args... });\n+\t\t\tBoundMethodBase::activatePack(new PackType{ args... }, false);\n \t\telse\n \t\t\t(static_cast<T *>(this->obj_)->*func_)(args...);\n \t}\ndiff --git a/include/libcamera/object.h b/include/libcamera/object.h\nindex 3308330af857..603a229288c2 100644\n--- a/include/libcamera/object.h\n+++ b/include/libcamera/object.h\n@@ -33,10 +33,12 @@ public:\n \tvoid invokeMethod(void (T::*func)(Args...), Args... args)\n \t{\n \t\tT *obj = static_cast<T *>(this);\n-\t\tBoundMethodBase *method = new BoundMemberMethod<T, Args...>(obj, this, func);\n+\t\tBoundMethodBase *method =\n+\t\t\tnew BoundMemberMethod<T, Args...>(obj, this, func,\n+\t\t\t\t\t\t\t  ConnectionTypeQueued);\n \t\tvoid *pack = new typename BoundMemberMethod<T, Args...>::PackType{ args... };\n \n-\t\tinvokeMethod(method, pack);\n+\t\tmethod->activatePack(pack, true);\n \t}\n \n \tThread *thread() const { return thread_; }\n@@ -53,8 +55,6 @@ private:\n \tfriend class BoundMethodBase;\n \tfriend class Thread;\n \n-\tvoid invokeMethod(BoundMethodBase *method, void *pack);\n-\n \tvoid notifyThreadMove();\n \n \tvoid connect(SignalBase *signal);\ndiff --git a/src/libcamera/bound_method.cpp b/src/libcamera/bound_method.cpp\nindex 600717363444..4c0cd415a3f1 100644\n--- a/src/libcamera/bound_method.cpp\n+++ b/src/libcamera/bound_method.cpp\n@@ -48,7 +48,7 @@ namespace libcamera {\n  * deadlock will occur.\n  */\n \n-void BoundMethodBase::activatePack(void *pack)\n+void BoundMethodBase::activatePack(void *pack, bool deleteMethod)\n {\n \tConnectionType type = connectionType_;\n \tif (type == ConnectionTypeAuto) {\n@@ -66,7 +66,7 @@ void BoundMethodBase::activatePack(void *pack)\n \n \tcase ConnectionTypeQueued: {\n \t\tstd::unique_ptr<Message> msg =\n-\t\t\tutils::make_unique<InvokeMessage>(this, pack);\n+\t\t\tutils::make_unique<InvokeMessage>(this, pack, nullptr, deleteMethod);\n \t\tobject_->postMessage(std::move(msg));\n \t\tbreak;\n \t}\n@@ -75,7 +75,7 @@ void BoundMethodBase::activatePack(void *pack)\n \t\tSemaphore semaphore;\n \n \t\tstd::unique_ptr<Message> msg =\n-\t\t\tutils::make_unique<InvokeMessage>(this, pack, &semaphore);\n+\t\t\tutils::make_unique<InvokeMessage>(this, pack, &semaphore, deleteMethod);\n \t\tobject_->postMessage(std::move(msg));\n \n \t\tsemaphore.acquire();\ndiff --git a/src/libcamera/object.cpp b/src/libcamera/object.cpp\nindex b0818f9aa25f..509b2ebac537 100644\n--- a/src/libcamera/object.cpp\n+++ b/src/libcamera/object.cpp\n@@ -153,13 +153,6 @@ void Object::message(Message *msg)\n  * remains valid until the method is invoked.\n  */\n \n-void Object::invokeMethod(BoundMethodBase *method, void *args)\n-{\n-\tstd::unique_ptr<Message> msg =\n-\t\tutils::make_unique<InvokeMessage>(method, args, nullptr, true);\n-\tpostMessage(std::move(msg));\n-}\n-\n /**\n  * \\fn Object::thread()\n  * \\brief Retrieve the thread the object is bound to\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "6/9"
    ]
}