Patch Detail
Show a patch.
GET /api/1.1/patches/12267/?format=api
{ "id": 12267, "url": "https://patchwork.libcamera.org/api/1.1/patches/12267/?format=api", "web_url": "https://patchwork.libcamera.org/patch/12267/", "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": "<20210513092246.42847-6-jacopo@jmondi.org>", "date": "2021-05-13T09:22:43", "name": "[libcamera-devel,v2,5/8] android: Replace scoped_lock<> with libcamera::MutexLocker", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "5224c0bc52336fd23108242145eb64a14244d6ee", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": { "id": 15, "url": "https://patchwork.libcamera.org/api/1.1/users/15/?format=api", "username": "jmondi", "first_name": "Jacopo", "last_name": "Mondi", "email": "jacopo@jmondi.org" }, "mbox": "https://patchwork.libcamera.org/patch/12267/mbox/", "series": [ { "id": 2025, "url": "https://patchwork.libcamera.org/api/1.1/series/2025/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2025", "date": "2021-05-13T09:22:38", "name": "Implement flush() camera operation", "version": 2, "mbox": "https://patchwork.libcamera.org/series/2025/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/12267/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/12267/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 472F5C31EE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 13 May 2021 09:22:15 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1586968921;\n\tThu, 13 May 2021 11:22:15 +0200 (CEST)", "from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net\n\t[217.70.183.193])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8B10368919\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 13 May 2021 11:22:10 +0200 (CEST)", "from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay1-d.mail.gandi.net (Postfix) with ESMTPSA id C12E3240007;\n\tThu, 13 May 2021 09:22:09 +0000 (UTC)" ], "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 13 May 2021 11:22:43 +0200", "Message-Id": "<20210513092246.42847-6-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.31.1", "In-Reply-To": "<20210513092246.42847-1-jacopo@jmondi.org>", "References": "<20210513092246.42847-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v2 5/8] android: Replace scoped_lock<>\n\twith libcamera::MutexLocker", "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=\"utf-8\"", "Content-Transfer-Encoding": "base64", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "The CameraDevice class uses std::scoped_lock<> to guard access to the\nclass' descriptors_ member.\n\nstd::scoped_lock<> provides a set of features that guarantees safety\nwhen locking multiple mutexes in a critical section, while for single\nlocks happening in a scoped block it does not provides benefits compared\nto the simplest std::unique_lock<> which libcamera provides the\nMutexLocker type for.\n\nReplace usage of std::scoped_lock<> with libcamera::MutexLocker to make\nthe implementation consistent with the rest of the code base.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/android/camera_device.cpp | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)", "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 82dd7ce0ee99..8a4543f079eb 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -23,6 +23,7 @@\n \n #include \"libcamera/internal/formats.h\"\n #include \"libcamera/internal/log.h\"\n+#include \"libcamera/internal/thread.h\"\n #include \"libcamera/internal/utils.h\"\n \n #include \"system/graphics.h\"\n@@ -2018,7 +2019,7 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques\n \tworker_.queueRequest(descriptor.request_.get());\n \n \t{\n-\t\tstd::scoped_lock<std::mutex> lock(mutex_);\n+\t\tMutexLocker lock(mutex_);\n \t\tdescriptors_[descriptor.request_->cookie()] = std::move(descriptor);\n \t}\n \n@@ -2029,7 +2030,7 @@ void CameraDevice::requestComplete(Request *request)\n {\n \tdecltype(descriptors_)::node_type node;\n \t{\n-\t\tstd::scoped_lock<std::mutex> lock(mutex_);\n+\t\tMutexLocker lock(mutex_);\n \t\tauto it = descriptors_.find(request->cookie());\n \t\tif (it == descriptors_.end()) {\n \t\t\t/*\n", "prefixes": [ "libcamera-devel", "v2", "5/8" ] }