Show a patch.

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

{
    "id": 1821,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/1821/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/1821/",
    "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": "<20190817152104.10834-4-laurent.pinchart@ideasonboard.com>",
    "date": "2019-08-17T15:20:49",
    "name": "[libcamera-devel,v2,03/18] libcamera: thread: Support dispatching messages to main thread",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "532a2a359b499fa93a4d045c7cfd033cfe01e4e9",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/1821/mbox/",
    "series": [
        {
            "id": 463,
            "url": "https://patchwork.libcamera.org/api/1.1/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/1821/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/1821/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 0AB15600F9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 17 Aug 2019 17:21:14 +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 A4F9E98C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 17 Aug 2019 17:21:13 +0200 (CEST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1566055273;\n\tbh=jWaQHPYiVdXbmTXAPOfMiZFcMdagOGG4maW9rwlfRGg=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=RUsJ0yJ3WrPL1MQGNkIFD+zUreQQuCEtwmspGmL3J3cS3/N4Zd9UUtPBogHLUbIa6\n\txm+0Oi9aLhyD1baJbTM2J5HLJSYY9t/c9wbjURSM3dpetzifAO1K6W2w1Uv8IZPj/z\n\th+WkxrXWCgGM9lNLGdnZxoqdMjpBdLe+aPxyj2y0=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sat, 17 Aug 2019 18:20:49 +0300",
        "Message-Id": "<20190817152104.10834-4-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 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": "Sat, 17 Aug 2019 15:21:14 -0000"
    },
    "content": "Threads contain message queues and dispatch queued 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>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\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",
        "v2",
        "03/18"
    ]
}