Patch Detail
Show a patch.
GET /api/patches/12364/?format=api
{ "id": 12364, "url": "https://patchwork.libcamera.org/api/patches/12364/?format=api", "web_url": "https://patchwork.libcamera.org/patch/12364/", "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": "<20210523023155.20268-2-laurent.pinchart@ideasonboard.com>", "date": "2021-05-23T02:31:52", "name": "[libcamera-devel,1/4] libcamera: thread: Document dispatchMessages() thread-safety requirements", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "37e88fab6b4579e3ef78d33635a2f392e03e171a", "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/12364/mbox/", "series": [ { "id": 2049, "url": "https://patchwork.libcamera.org/api/series/2049/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2049", "date": "2021-05-23T02:31:51", "name": "libcamera: thread: Documentation fixes and enhancements", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2049/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/12364/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/12364/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 751F9C3200\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 23 May 2021 02:32:05 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4DB1F68921;\n\tSun, 23 May 2021 04:32:04 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9F5CE68911\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 23 May 2021 04:32:01 +0200 (CEST)", "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2E03F89A;\n\tSun, 23 May 2021 04:32:01 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"e97OAABc\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1621737121;\n\tbh=ekMaN0LjvgaW6Wcf8DnKW8+/k+nO8ZduHf1bqtbnB3Q=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=e97OAABcdu5xFVRimB3Hp9Hvd2ocRgbmDVRRe9imq3AABja0JWxD1kJva7I3/5n58\n\t+OZLrrzgXRLNU40N+BMMBaWnEUd8tACw4eZtGbRF5WI532od6JjFDzorTj//faXard\n\tIJ7/sArAqKXKzO/iGVoI7X0gG8//eE4+ivEmHANg=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sun, 23 May 2021 05:31:52 +0300", "Message-Id": "<20210523023155.20268-2-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.28.1", "In-Reply-To": "<20210523023155.20268-1-laurent.pinchart@ideasonboard.com>", "References": "<20210523023155.20268-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 1/4] libcamera: thread: Document\n\tdispatchMessages() thread-safety requirements", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "The Thread class is incorrectly documented as thread-safe, as the\ndispatchMessages() function isn't thread-safe. Fix the documentation by\ntagging individual functions as thread-safe as appropriate.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/thread.cpp | 17 +++++++++++++++--\n 1 file changed, 15 insertions(+), 2 deletions(-)", "diff": "diff --git a/src/libcamera/thread.cpp b/src/libcamera/thread.cpp\nindex 198670de33a2..285b808332e8 100644\n--- a/src/libcamera/thread.cpp\n+++ b/src/libcamera/thread.cpp\n@@ -229,8 +229,6 @@ ThreadData *ThreadData::current()\n * called. The event loop dispatches events (messages, notifiers and timers)\n * sent to the objects living in the thread. This behaviour can be modified by\n * overriding the run() function.\n- *\n- * \\context This class is \\threadsafe.\n */\n \n /**\n@@ -361,6 +359,8 @@ void Thread::finishThread()\n *\n * Calling exit() on a thread that reimplements the run() method and doesn't\n * call exec() will likely have no effect.\n+ *\n+ * \\context This function is \\threadsafe.\n */\n void Thread::exit(int code)\n {\n@@ -383,6 +383,8 @@ void Thread::exit(int code)\n * utils::duration::max(), the wait never times out. If the thread is not\n * running the function returns immediately.\n *\n+ * \\context This function is \\threadsafe.\n+ *\n * \\return True if the thread has finished, or false if the wait timed out\n */\n bool Thread::wait(utils::duration duration)\n@@ -412,6 +414,8 @@ bool Thread::wait(utils::duration duration)\n * started. This method guarantees that it returns true after the start()\n * method returns, and false after the wait() method returns.\n *\n+ * \\context This function is \\threadsafe.\n+ *\n * \\return True if the thread is running, false otherwise\n */\n bool Thread::isRunning()\n@@ -427,6 +431,7 @@ bool Thread::isRunning()\n \n /**\n * \\brief Retrieve the Thread instance for the current thread\n+ * \\context This function is \\threadsafe.\n * \\return The Thread instance for the current thread\n */\n Thread *Thread::current()\n@@ -441,6 +446,8 @@ Thread *Thread::current()\n * The thread ID corresponds to the Linux thread ID (TID) as returned by the\n * gettid system call.\n *\n+ * \\context This function is \\threadsafe.\n+ *\n * \\return The ID of the current thread\n */\n pid_t Thread::currentId()\n@@ -455,6 +462,8 @@ pid_t Thread::currentId()\n * This function retrieves the internal event dispatcher for the thread. The\n * returned event dispatcher is valid until the thread is destroyed.\n *\n+ * \\context This function is \\threadsafe.\n+ *\n * \\return Pointer to the event dispatcher\n */\n EventDispatcher *Thread::eventDispatcher()\n@@ -544,6 +553,10 @@ void Thread::removeMessages(Object *receiver)\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+ * Messages shall only be dispatched from the current thread, typically within\n+ * the thread from the run() function. Calling this function outside of the\n+ * thread results in undefined behaviour.\n */\n void Thread::dispatchMessages(Message::Type type)\n {\n", "prefixes": [ "libcamera-devel", "1/4" ] }