Show a patch.

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

{
    "id": 15016,
    "url": "https://patchwork.libcamera.org/api/patches/15016/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15016/",
    "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": "<20211203164619.1541033-4-hiroh@chromium.org>",
    "date": "2021-12-03T16:46:15",
    "name": "[libcamera-devel,3/7] libcamera: base: thread: Apply clang thread safety annotation",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "7d332d753f1ad836072418da90d85f35b52c46b2",
    "submitter": {
        "id": 63,
        "url": "https://patchwork.libcamera.org/api/people/63/?format=api",
        "name": "Hirokazu Honda",
        "email": "hiroh@chromium.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/15016/mbox/",
    "series": [
        {
            "id": 2812,
            "url": "https://patchwork.libcamera.org/api/series/2812/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2812",
            "date": "2021-12-03T16:46:12",
            "name": "Apply clang thread safety annotation libcamera-core and v4l2",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2812/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15016/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15016/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 63F8DBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  3 Dec 2021 16:46:35 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1938560822;\n\tFri,  3 Dec 2021 17:46:35 +0100 (CET)",
            "from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com\n\t[IPv6:2607:f8b0:4864:20::102a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id ECEF360822\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  3 Dec 2021 17:46:31 +0100 (CET)",
            "by mail-pj1-x102a.google.com with SMTP id iq11so2758065pjb.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 03 Dec 2021 08:46:31 -0800 (PST)",
            "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:cd78:3a5f:d792:6177])\n\tby smtp.gmail.com with ESMTPSA id\n\th18sm4123149pfh.172.2021.12.03.08.46.28\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 03 Dec 2021 08:46:29 -0800 (PST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"FeSYt4Ow\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=pI8V8gbQRxT9tr/AaPVKtqTwDKeOmbZ37IXXJs9oD0Q=;\n\tb=FeSYt4Ow1X9Hob9sGY/yqRYnwtSxaCDpkQwomurTOgT1kt8gxRiuN+Y8wtTgxnhqDC\n\tro507TeUFglyjFJ4ed5LQsHhd259sYYcqksT7tRZOT106C59+lEyHoavQ7i8NPy1zC2d\n\ty437GbUMrcWBveq9JhciS/kI+pCmKJ9v8hB8Q=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=pI8V8gbQRxT9tr/AaPVKtqTwDKeOmbZ37IXXJs9oD0Q=;\n\tb=7Q7LC9L8S8AuQR2kxcqzSpeydeUm8Itn9YKkvWiNbHI4dJ780sBOPCR/5K8c75P6jf\n\tkIas/4nBtANl0+kxKL8koKt+1ExKK7VIuspWWXlsDUiaAbXmTbRxOEYsZaL/ikekn+Z9\n\tVrXkr2mT9QkPWEB57uUP6EqxVJkM7kuES15oZYHk4gq3dWEch6h80C4IvOQsMwv6cW9S\n\tpQxyY2InrUK7RkaoQAbMnMjMG1GG3EWWL9ljU0K8VpMXLqqAIk8uV6rLuO8lXergqCcE\n\tRxtx6iXK1MBDlGQWoxw/4jR4Z87WjMoSf4dsGr9JtPkEc/jcr8iG/Y2ORgChPjp4xNBJ\n\txXwg==",
        "X-Gm-Message-State": "AOAM531T3ppjnbb81BzbR14N0f1zIEKq2L0hHQz7UwB7F7i76XUWBiUS\n\t8OgnrCgjNaFGnqFLgLPh6Blb+EslAf2qRw==",
        "X-Google-Smtp-Source": "ABdhPJx//5GFSsakAGfXOSSc3JZbZsrQlEePLvi8P/Zvl6EOvatiwLWeRB78I8d/Dkdl1sQuwwn0aQ==",
        "X-Received": "by 2002:a17:902:904b:b0:143:73ff:eb7d with SMTP id\n\tw11-20020a170902904b00b0014373ffeb7dmr23451270plz.85.1638549989989; \n\tFri, 03 Dec 2021 08:46:29 -0800 (PST)",
        "From": "Hirokazu Honda <hiroh@chromium.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sat,  4 Dec 2021 01:46:15 +0900",
        "Message-Id": "<20211203164619.1541033-4-hiroh@chromium.org>",
        "X-Mailer": "git-send-email 2.34.0.384.gca35af8252-goog",
        "In-Reply-To": "<20211203164619.1541033-1-hiroh@chromium.org>",
        "References": "<20211203164619.1541033-1-hiroh@chromium.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 3/7] libcamera: base: thread: Apply clang\n\tthread safety annotation",
        "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": "This annotates member variables of ThreadData by clang thread\nsafety annotations.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/libcamera/base/thread.cpp | 24 ++++++++++++++++--------\n 1 file changed, 16 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/src/libcamera/base/thread.cpp b/src/libcamera/base/thread.cpp\nindex abd33a83..205f3d1b 100644\n--- a/src/libcamera/base/thread.cpp\n+++ b/src/libcamera/base/thread.cpp\n@@ -151,7 +151,7 @@ private:\n \tfriend class ThreadMain;\n \n \tThread *thread_;\n-\tbool running_;\n+\tbool running_ LIBCAMERA_TSA_GUARDED_BY(mutex_);\n \tpid_t tid_;\n \n \tMutex mutex_;\n@@ -160,7 +160,7 @@ private:\n \n \tConditionVariable cv_;\n \tstd::atomic<bool> exit_;\n-\tint exitCode_;\n+\tint exitCode_ LIBCAMERA_TSA_GUARDED_BY(mutex_);\n \n \tMessageQueue messages_;\n };\n@@ -390,7 +390,7 @@ void Thread::finishThread()\n  *\n  * \\context This function is \\threadsafe.\n  */\n-void Thread::exitint code)\n+void Thread::exit(int code)\n {\n \tdata_->mutex_.lock();\n \tdata_->exitCode_ = code;\n@@ -424,11 +424,19 @@ bool Thread::wait(utils::duration duration)\n \t{\n \t\tMutexLocker locker(data_->mutex_);\n \n-\t\tif (duration == utils::duration::max())\n-\t\t\tdata_->cv_.wait(locker, [&]() { return !data_->running_; });\n-\t\telse\n-\t\t\thasFinished = data_->cv_.wait_for(locker, duration,\n-\t\t\t\t\t\t\t  [&]() { return !data_->running_; });\n+\t\tif (duration == utils::duration::max()) {\n+\t\t\tdata_->cv_.wait(\n+\t\t\t\tlocker,\n+\t\t\t\t[&]() LIBCAMERA_TSA_REQUIRES(data_->mutex_) {\n+\t\t\t\t\treturn !data_->running_;\n+\t\t\t\t});\n+\t\t} else {\n+\t\t\thasFinished = data_->cv_.wait_for(\n+\t\t\t\tlocker, duration,\n+\t\t\t\t[&]() LIBCAMERA_TSA_REQUIRES(data_->mutex_) {\n+\t\t\t\t\treturn !data_->running_;\n+\t\t\t\t});\n+\t\t}\n \t}\n \n \tif (thread_.joinable())\n",
    "prefixes": [
        "libcamera-devel",
        "3/7"
    ]
}