[{"id":2428,"web_url":"https://patchwork.libcamera.org/comment/2428/","msgid":"<20190817140728.GF16603@wyvern>","date":"2019-08-17T14:07:28","subject":"Re: [libcamera-devel] [PATCH 02/18] libcamera: thread: Wake up\n\ttarget thread when moving objects","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your work.\n\nOn 2019-08-12 15:46:26 +0300, Laurent Pinchart wrote:\n> When moving an object to a different thread, messages posted for the\n> object are moved to the message queue of the new thread. Wake up the new\n> thread to ensure it processes the moved messages.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  src/libcamera/thread.cpp | 10 ++++++++++\n>  1 file changed, 10 insertions(+)\n> \n> diff --git a/src/libcamera/thread.cpp b/src/libcamera/thread.cpp\n> index 5d46eeb8d3a5..6f86e4a90a05 100644\n> --- a/src/libcamera/thread.cpp\n> +++ b/src/libcamera/thread.cpp\n> @@ -464,6 +464,8 @@ void Thread::moveObject(Object *object)\n>  \n>  \t/* Move pending messages to the message queue of the new thread. */\n>  \tif (object->pendingMessages_) {\n> +\t\tunsigned int movedMessages = 0;\n> +\n>  \t\tfor (std::unique_ptr<Message> &msg : currentData->messages_.list_) {\n>  \t\t\tif (!msg)\n>  \t\t\t\tcontinue;\n> @@ -471,6 +473,14 @@ void Thread::moveObject(Object *object)\n>  \t\t\t\tcontinue;\n>  \n>  \t\t\ttargetData->messages_.list_.push_back(std::move(msg));\n> +\t\t\tmovedMessages++;\n> +\t\t}\n> +\n> +\t\tif (movedMessages) {\n> +\t\t\tEventDispatcher *dispatcher =\n> +\t\t\t\ttargetData->dispatcher_.load(std::memory_order_acquire);\n> +\t\t\tif (dispatcher)\n> +\t\t\t\tdispatcher->interrupt();\n>  \t\t}\n>  \t}\n>  \n> -- \n> Regards,\n> \n> Laurent Pinchart\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-ed1-x541.google.com (mail-ed1-x541.google.com\n\t[IPv6:2a00:1450:4864:20::541])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 84CED600F9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 17 Aug 2019 16:07:30 +0200 (CEST)","by mail-ed1-x541.google.com with SMTP id s15so7503025edx.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 17 Aug 2019 07:07:30 -0700 (PDT)","from localhost ([185.224.57.161]) by smtp.gmail.com with ESMTPSA id\n\tf21sm1655241edj.36.2019.08.17.07.07.29\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSat, 17 Aug 2019 07:07:29 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=Q1KrCKLfZ9hKfMrP4gkbEYrdBw4Yi58yUFiStfMx/zM=;\n\tb=ALZCgiW1weZm1pW3g/WtncRxxP8atyHejDvwIl6OGgyq/laFG3LfhqgrQ7vNEt2h9j\n\tlpXwSQGXxKHFn/pJKDRmW7FfwV7AeSJGxths27LWSaS43WGYEJ6Fa8E3l93KqBhxHkRz\n\tZ1ptlZltGWVn56ql9lFTLsOmmSa7skpMl3rgikOrl9L3pgnYOkptKjcffnCbO5y9xJWq\n\t4YqpS4WTJVd3g4u0WvIZYk+nKqVME4YNO6qJ8+gUXgVzOT06ZF+X1Rn7on16ukwvZRjo\n\thGY8mByA0QcW1HwIk4Mu9wQSNhRWbLbJPw1gpmaIPTulV/WD1G9UB38fe+COtncEUV8d\n\taBGw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=Q1KrCKLfZ9hKfMrP4gkbEYrdBw4Yi58yUFiStfMx/zM=;\n\tb=Exc+4q3chGwqY3MhdxVZviLM8pksEVuF4oYbr+4qOYKFTJfeqbzGLSCPyl9a0/qK83\n\t4f6cIjiPArzYR1TUUeeXQzrXWqvyiASNm2VzN9OGku+VtBZB3+CE+cMcWY3RApaEVZmG\n\tKIij6a0Zi0edOze/F2dPxXgzv6SFXJqHBg3YL4RtPaSidcfGHlGMnR6Fx1d91bFgHTwD\n\tk4qer4MJxia5Y3/+YETGUfOrhVAjwz2wRAGtDfAqbtlP0I0GFH5QvRuLyd5mzONtQd47\n\tpRWfzymw9ixu7Mx5dq43Yhx68lRGbjAbvDc+SdTYM7oraij7iJJ4oLzLUaQQQpm3EtFC\n\t+xKQ==","X-Gm-Message-State":"APjAAAUa8u6R/PDf/T6pgLLhLJ2LKlkiB0ZoPvbrZPtCqIiyvKZMYqon\n\tenDRpUEVPFwZ4NCX52Hp0WSeOiuQOH8=","X-Google-Smtp-Source":"APXvYqwL/hDQq4z6SzQR0N6Xpkw5MQwyXgWOWEonPA4dHM1RuAkguls3Zekb6ghn5+QfqlkwcKdN8A==","X-Received":"by 2002:aa7:cd17:: with SMTP id\n\tb23mr16373340edw.278.1566050850260; \n\tSat, 17 Aug 2019 07:07:30 -0700 (PDT)","Date":"Sat, 17 Aug 2019 16:07:28 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190817140728.GF16603@wyvern>","References":"<20190812124642.24287-1-laurent.pinchart@ideasonboard.com>\n\t<20190812124642.24287-3-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190812124642.24287-3-laurent.pinchart@ideasonboard.com>","User-Agent":"Mutt/1.12.1 (2019-06-15)","Subject":"Re: [libcamera-devel] [PATCH 02/18] libcamera: thread: Wake up\n\ttarget thread when moving objects","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 14:07:30 -0000"}}]