Patch Detail
Show a patch.
GET /api/patches/1825/?format=api
{ "id": 1825, "url": "https://patchwork.libcamera.org/api/patches/1825/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1825/", "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": "<20190817152104.10834-8-laurent.pinchart@ideasonboard.com>", "date": "2019-08-17T15:20:53", "name": "[libcamera-devel,v2,07/18] libcamera: object: Notify objects of thread move", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "c8a8ef701cdc3811055687bdf94eea5995285c7d", "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/1825/mbox/", "series": [ { "id": 463, "url": "https://patchwork.libcamera.org/api/series/463/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=463", "date": "2019-08-17T15:20:46", "name": "Object & Thread enhancements", "version": 2, "mbox": "https://patchwork.libcamera.org/series/463/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1825/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1825/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7BBC361920\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 17 Aug 2019 17:21:15 +0200 (CEST)", "from pendragon.bb.dnainternet.fi\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 228ED98C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 17 Aug 2019 17:21:15 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1566055275;\n\tbh=Mtdd7I7/fCDQdmHSxFkDcsgRcspZAog9hGuiaCKyECY=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=tPKVxygq/RUJ2BTFVfG3AluMiac7jkzmeMiHarR2hwgBYt5PkyRaRZ3J2+yQgG8hp\n\tC5FYKJZjaaPORztImOjYh1P5iOyG6D7iHwJP4n/u3a2D2Kx6+eAmjCTeyHmcoMXwwr\n\tNibHcYsQi2u8I6pizMa1w1kL8IwHkL5W1+C4l950=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sat, 17 Aug 2019 18:20:53 +0300", "Message-Id": "<20190817152104.10834-8-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20190817152104.10834-1-laurent.pinchart@ideasonboard.com>", "References": "<20190817152104.10834-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 07/18] libcamera: object: Notify\n\tobjects of thread move", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.23", "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": "Sat, 17 Aug 2019 15:21:16 -0000" }, "content": "Send a synchronous message to objects just before they get moved to a\nnew thread. This allows the object to perform any required processing.\nEventNotifier and Timer objects will use this mechanism to move\nthemselves to the new thread's event disaptcher.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\nChanges since v1:\n\n- Drop Object::sendMessage()\n---\n include/libcamera/object.h | 2 ++\n src/libcamera/include/message.h | 1 +\n src/libcamera/message.cpp | 2 ++\n src/libcamera/object.cpp | 12 ++++++++++++\n 4 files changed, 17 insertions(+)", "diff": "diff --git a/include/libcamera/object.h b/include/libcamera/object.h\nindex 869200a57d8c..e128c75e7db8 100644\n--- a/include/libcamera/object.h\n+++ b/include/libcamera/object.h\n@@ -52,6 +52,8 @@ private:\n \n \tvoid invokeMethod(BoundMethodBase *method, void *pack);\n \n+\tvoid notifyThreadMove();\n+\n \tvoid connect(SignalBase *signal);\n \tvoid disconnect(SignalBase *signal);\n \ndiff --git a/src/libcamera/include/message.h b/src/libcamera/include/message.h\nindex 92717e316cc3..1cfde5669ede 100644\n--- a/src/libcamera/include/message.h\n+++ b/src/libcamera/include/message.h\n@@ -23,6 +23,7 @@ public:\n \tenum Type {\n \t\tNone = 0,\n \t\tInvokeMessage = 1,\n+\t\tThreadMoveMessage = 2,\n \t\tUserMessage = 1000,\n \t};\n \ndiff --git a/src/libcamera/message.cpp b/src/libcamera/message.cpp\nindex f6c39d40fc73..efafb655c17e 100644\n--- a/src/libcamera/message.cpp\n+++ b/src/libcamera/message.cpp\n@@ -47,6 +47,8 @@ std::atomic_uint Message::nextUserType_{ Message::UserMessage };\n * \\brief Invalid message type\n * \\var Message::InvokeMessage\n * \\brief Asynchronous method invocation across threads\n+ * \\var Message::ThreadMoveMessage\n+ * \\brief Object is being moved to a different thread\n * \\var Message::UserMessage\n * \\brief First value available for user-defined messages\n */\ndiff --git a/src/libcamera/object.cpp b/src/libcamera/object.cpp\nindex 7d70ce21b5d0..bbb28f261405 100644\n--- a/src/libcamera/object.cpp\n+++ b/src/libcamera/object.cpp\n@@ -135,6 +135,10 @@ void Object::invokeMethod(BoundMethodBase *method, void *args)\n * This method moves the object from the current thread to the new \\a thread.\n * It shall be called from the thread in which the object currently lives,\n * otherwise the behaviour is undefined.\n+ *\n+ * Before the object is moved, a Message::ThreadMoveMessage message is sent to\n+ * it. The message() method can be reimplement in derived classes to be notified\n+ * of the upcoming thread move and perform any required processing.\n */\n void Object::moveToThread(Thread *thread)\n {\n@@ -143,9 +147,17 @@ void Object::moveToThread(Thread *thread)\n \tif (thread_ == thread)\n \t\treturn;\n \n+\tnotifyThreadMove();\n+\n \tthread->moveObject(this);\n }\n \n+void Object::notifyThreadMove()\n+{\n+\tMessage msg(Message::ThreadMoveMessage);\n+\tmessage(&msg);\n+}\n+\n void Object::connect(SignalBase *signal)\n {\n \tsignals_.push_back(signal);\n", "prefixes": [ "libcamera-devel", "v2", "07/18" ] }