[{"id":18041,"web_url":"https://patchwork.libcamera.org/comment/18041/","msgid":"<7e3412ff-ca5b-7fbe-77c0-1a815cd8f3ee@ideasonboard.com>","date":"2021-07-09T09:44:11","subject":"Re: [libcamera-devel] [PATCH 1/3] base: thread: Document the\n\tpostMessage() function as thread-safe","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Laurent,\n\nOn 02/07/2021 00:07, Laurent Pinchart wrote:\n> The Thread::postMessage() function is thread-safe, document it as such.\n\n\nWell this is short and sweet, so I presume you're sure.\n\n\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/libcamera/base/thread.cpp | 2 ++\n>  1 file changed, 2 insertions(+)\n> \n> diff --git a/src/libcamera/base/thread.cpp b/src/libcamera/base/thread.cpp\n> index c7c2d6b29d6a..7f79115222e8 100644\n> --- a/src/libcamera/base/thread.cpp\n> +++ b/src/libcamera/base/thread.cpp\n> @@ -526,6 +526,8 @@ EventDispatcher *Thread::eventDispatcher()\n>   *\n>   * If the \\a receiver is not bound to this thread the behaviour is undefined.\n>   *\n> + * \\context This function is \\threadsafe.\n> + *\n\nIt's curious how the preceding statement declares how this might cause\nundefined behaviour, but then we say 'but we're safe'.\n\nHowever, while a little close, I think the intentions are still fairly\nclear and that these refer to two different contexts...\n\nI.e.\n - This function can be called from any thread, but it acts upon the\nThread object and the Thread object must be the one which contains the\ntarget object which will receive the message.\n\nSo .. in other long words, I think it's fine.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n\n>   * \\sa exec()\n>   */\n>  void Thread::postMessage(std::unique_ptr<Message> msg, Object *receiver)\n>","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 5D01EC3224\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  9 Jul 2021 09:44:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 94DA76851F;\n\tFri,  9 Jul 2021 11:44:16 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1C1DE684F3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  9 Jul 2021 11:44:14 +0200 (CEST)","from [192.168.0.20]\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AA939E7;\n\tFri,  9 Jul 2021 11:44:13 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"kPwJ8EgG\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1625823853;\n\tbh=wkXblXAf8t7TaTBQzJRhs0QGbcF3J4cmFJngcSWlqN8=;\n\th=To:References:From:Subject:Date:In-Reply-To:From;\n\tb=kPwJ8EgGcQSiV82DrMbGfb6HlFDe6239DBqXHJemLKpyYeD9l4j2A6QtyDTyIjCpQ\n\tXR/a9q+lc6mcnfqw8LfFnMBQJbZFuTA1/BRGNW6U4F+QP5StyKIiTXzk6DTZ+NS+RC\n\t9IsCcIwQ/rZazmsgmhOq5+w9ZvgZnrFMVm8i12JE=","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20210701230741.14320-1-laurent.pinchart@ideasonboard.com>\n\t<20210701230741.14320-2-laurent.pinchart@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<7e3412ff-ca5b-7fbe-77c0-1a815cd8f3ee@ideasonboard.com>","Date":"Fri, 9 Jul 2021 10:44:11 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.11.0","MIME-Version":"1.0","In-Reply-To":"<20210701230741.14320-2-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"8bit","Subject":"Re: [libcamera-devel] [PATCH 1/3] base: thread: Document the\n\tpostMessage() function as thread-safe","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>"}}]