Patch Detail
Show a patch.
GET /api/1.1/patches/9119/?format=api
{ "id": 9119, "url": "https://patchwork.libcamera.org/api/1.1/patches/9119/?format=api", "web_url": "https://patchwork.libcamera.org/patch/9119/", "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": "<20200731181410.99892-2-email@uajain.com>", "date": "2020-07-31T18:14:14", "name": "[libcamera-devel,v4,1/4] libcamera: thread: Support selective message dispatch to thread", "commit_ref": "3fe7c1cdb4e14aa4da0681103a33912f962c5cc8", "pull_url": null, "state": "accepted", "archived": false, "hash": "8d6d4a7595c180a190dd017c97bf0290e7f5748b", "submitter": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/people/1/?format=api", "name": "Umang Jain", "email": "email@uajain.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/9119/mbox/", "series": [ { "id": 1172, "url": "https://patchwork.libcamera.org/api/1.1/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/9119/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/9119/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 D5FC1BD86F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 31 Jul 2020 18:14:18 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A15D561EEF;\n\tFri, 31 Jul 2020 20:14:17 +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 EEE28611A2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 31 Jul 2020 20:14:15 +0200 (CEST)", "by filterdrecv-p3mdw1-7ff865655c-svvjh with SMTP id\n\tfilterdrecv-p3mdw1-7ff865655c-svvjh-19-5F245F76-23\n\t2020-07-31 18:14:14.634886421 +0000 UTC m=+172681.736483684", "from mail.uajain.com (unknown)\n\tby ismtpd0004p1maa1.sendgrid.net (SG) with ESMTP\n\tid r6JYpAVDSvCRRpNU_9H40Q Fri, 31 Jul 2020 18:14:14.242 +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=\"NTk0kvq3\"; 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=YBXjP0n0lj5BCprVeWF7WmtypCWAldJAIa3SQ0eIJ6o=;\n\tb=NTk0kvq3Fo4w1tn9VPcMgJRsZ8qpEgZN299loTSbcJHwRpS0Dr8Xmjs7wG0DQ9DZz2of\n\tUKDsdJckY4m38s3px8PJIQIeYv5zT0oYmSLenIO1nev25gPt0owrXwQdENs4NBFw/tenBX\n\ttn5kdZHISBr6pT/Yz01HzkhULsN5vQsZE=", "From": "Umang Jain <email@uajain.com>", "Date": "Fri, 31 Jul 2020 18:14:14 +0000 (UTC)", "Message-Id": "<20200731181410.99892-2-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/L3L9rFqlwE4KPcIgOyDPOiX995eQdp4XFd3MB3kKT368qXzPWOoATU15gwFH1GX3Qhzp4UW2Y1Up/mNVFGoWyp0D1uU2FcX/ObcDnR2GbHI+CA3pXo6kcRfJksVy4ehV5v0XVOHD/o+BTUusOJ8DVu/K9O8VMDNHsL5NWPO9tEEHWVO+O9n8UMycXlhcTdlZInhjlZIGoqbRWblmwBohQ4p9ltxY7KNk1fiA==", "To": "libcamera-devel@lists.libcamera.org", "Subject": "[libcamera-devel] [PATCH v4 1/4] libcamera: thread: Support\n\tselective message dispatch to 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>", "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": "Extend the current dispatchMessages() to support dispatching of\nselective messsages according to the Message::Type passed in\nthe function argument. dispatchMessages() can now be called\nexplicitly to force deliver selected type's message to the\nthread for processing (typically when event loop is not\nrunning).\n\nSigned-off-by: Umang Jain <email@uajain.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/internal/thread.h | 3 ++-\n src/libcamera/thread.cpp | 35 +++++++++++++++++++++--------\n 2 files changed, 28 insertions(+), 10 deletions(-)", "diff": "diff --git a/include/libcamera/internal/thread.h b/include/libcamera/internal/thread.h\nindex 7b59e58..f6367a8 100644\n--- a/include/libcamera/internal/thread.h\n+++ b/include/libcamera/internal/thread.h\n@@ -14,6 +14,7 @@\n \n #include <libcamera/signal.h>\n \n+#include \"libcamera/internal/message.h\"\n #include \"libcamera/internal/utils.h\"\n \n namespace libcamera {\n@@ -47,7 +48,7 @@ public:\n \tEventDispatcher *eventDispatcher();\n \tvoid setEventDispatcher(std::unique_ptr<EventDispatcher> dispatcher);\n \n-\tvoid dispatchMessages();\n+\tvoid dispatchMessages(Message::Type type = Message::Type::None);\n \n protected:\n \tint exec();\ndiff --git a/src/libcamera/thread.cpp b/src/libcamera/thread.cpp\nindex d1750d7..87006a9 100644\n--- a/src/libcamera/thread.cpp\n+++ b/src/libcamera/thread.cpp\n@@ -552,25 +552,42 @@ void Thread::removeMessages(Object *receiver)\n }\n \n /**\n- * \\brief Dispatch all posted messages for this thread\n+ * \\brief Dispatch posted messages for this thread\n+ * \\param[in] type The message type\n+ *\n+ * This function immediately dispatches all the messages previously posted for\n+ * this thread with postMessage() that match the message \\a type. If the \\a type\n+ * is Message::Type::None, all messages are dispatched.\n */\n-void Thread::dispatchMessages()\n+void Thread::dispatchMessages(Message::Type type)\n {\n \tMutexLocker locker(data_->messages_.mutex_);\n \n-\twhile (!data_->messages_.list_.empty()) {\n-\t\tstd::unique_ptr<Message> msg = std::move(data_->messages_.list_.front());\n-\t\tdata_->messages_.list_.pop_front();\n-\t\tif (!msg)\n+\tstd::list<std::unique_ptr<Message>> &messages = data_->messages_.list_;\n+\n+\tfor (auto iter = messages.begin(); iter != messages.end(); ) {\n+\t\tstd::unique_ptr<Message> &msg = *iter;\n+\n+\t\tif (!msg) {\n+\t\t\titer = data_->messages_.list_.erase(iter);\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tif (type != Message::Type::None && msg->type() != type) {\n+\t\t\t++iter;\n \t\t\tcontinue;\n+\t\t}\n \n-\t\tObject *receiver = msg->receiver_;\n-\t\tASSERT(data_ == receiver->thread()->data_);\n+\t\tstd::unique_ptr<Message> message = std::move(msg);\n+\t\titer = data_->messages_.list_.erase(iter);\n \n+\t\tObject *receiver = message->receiver_;\n+\t\tASSERT(data_ == receiver->thread()->data_);\n \t\treceiver->pendingMessages_--;\n \n \t\tlocker.unlock();\n-\t\treceiver->message(msg.get());\n+\t\treceiver->message(message.get());\n+\t\tmessage.reset();\n \t\tlocker.lock();\n \t}\n }\n", "prefixes": [ "libcamera-devel", "v4", "1/4" ] }