Patch Detail
Show a patch.
GET /api/patches/1781/?format=api
{ "id": 1781, "url": "https://patchwork.libcamera.org/api/patches/1781/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1781/", "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": "<20190812124642.24287-4-laurent.pinchart@ideasonboard.com>", "date": "2019-08-12T12:46:27", "name": "[libcamera-devel,03/18] libcamera: thread: Support dispatching messages to main thread", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "532a2a359b499fa93a4d045c7cfd033cfe01e4e9", "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/1781/mbox/", "series": [ { "id": 455, "url": "https://patchwork.libcamera.org/api/series/455/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=455", "date": "2019-08-12T12:46:24", "name": "Object & Thread enhancements", "version": 1, "mbox": "https://patchwork.libcamera.org/series/455/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1781/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1781/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 EAE2C60E38\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Aug 2019 14:46:49 +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 86B3C594\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Aug 2019 14:46:49 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1565614009;\n\tbh=JL6icfRv59UQAMHOVt8DJGpk6nFLqIeWcf4xWR2Z+kA=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=tb/wR2Ip6NXZIX4e4K7xlus0eJ/6QGyDK6FemeUXdDcj0FpuyP5sOQO6ue0dS0S4T\n\t5UzYpR2sGDxDGTah4LOUMZEJx+6U4oC5w6DxlW719+4uAgg0NzmCa++Luwf7r1RVj2\n\ts5tcM3tILws9HqRSZLJ4aDMU+kCMAud/aCJji5fM=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 12 Aug 2019 15:46:27 +0300", "Message-Id": "<20190812124642.24287-4-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20190812124642.24287-1-laurent.pinchart@ideasonboard.com>", "References": "<20190812124642.24287-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 03/18] libcamera: thread: Support\n\tdispatching messages to main thread", "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": "Mon, 12 Aug 2019 12:46:50 -0000" }, "content": "Threads contain message queues and dispatch queue messages in their\nevent loop, in Thread::exec(). This mechanism prevents the main thread\nfrom dispatching messages as it doesn't run Thread::exec().\n\nFix this by moving message dispatching from Thread::exec() to\nEventDispatcher::processEvents().\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/event_dispatcher_poll.cpp | 3 +++\n src/libcamera/include/thread.h | 3 ++-\n src/libcamera/thread.cpp | 4 +---\n 3 files changed, 6 insertions(+), 4 deletions(-)", "diff": "diff --git a/src/libcamera/event_dispatcher_poll.cpp b/src/libcamera/event_dispatcher_poll.cpp\nindex 4f15f3e3269b..281f37bdbb16 100644\n--- a/src/libcamera/event_dispatcher_poll.cpp\n+++ b/src/libcamera/event_dispatcher_poll.cpp\n@@ -19,6 +19,7 @@\n #include <libcamera/timer.h>\n \n #include \"log.h\"\n+#include \"thread.h\"\n \n /**\n * \\file event_dispatcher_poll.h\n@@ -143,6 +144,8 @@ void EventDispatcherPoll::processEvents()\n {\n \tint ret;\n \n+\tThread::current()->dispatchMessages();\n+\n \t/* Create the pollfd array. */\n \tstd::vector<struct pollfd> pollfds;\n \tpollfds.reserve(notifiers_.size() + 1);\ndiff --git a/src/libcamera/include/thread.h b/src/libcamera/include/thread.h\nindex acae91cb6457..630abb49534f 100644\n--- a/src/libcamera/include/thread.h\n+++ b/src/libcamera/include/thread.h\n@@ -43,6 +43,8 @@ public:\n \tEventDispatcher *eventDispatcher();\n \tvoid setEventDispatcher(std::unique_ptr<EventDispatcher> dispatcher);\n \n+\tvoid dispatchMessages();\n+\n protected:\n \tint exec();\n \tvirtual void run();\n@@ -53,7 +55,6 @@ private:\n \n \tvoid postMessage(std::unique_ptr<Message> msg, Object *receiver);\n \tvoid removeMessages(Object *receiver);\n-\tvoid dispatchMessages();\n \n \tfriend class Object;\n \tfriend class ThreadData;\ndiff --git a/src/libcamera/thread.cpp b/src/libcamera/thread.cpp\nindex 6f86e4a90a05..24422f7b7bd0 100644\n--- a/src/libcamera/thread.cpp\n+++ b/src/libcamera/thread.cpp\n@@ -212,10 +212,8 @@ int Thread::exec()\n \n \tlocker.unlock();\n \n-\twhile (!data_->exit_.load(std::memory_order_acquire)) {\n-\t\tdispatchMessages();\n+\twhile (!data_->exit_.load(std::memory_order_acquire))\n \t\tdispatcher->processEvents();\n-\t}\n \n \tlocker.lock();\n \n", "prefixes": [ "libcamera-devel", "03/18" ] }