[libcamera-devel] [PATCH v2 2/8] utils: ipc: proxy: Process pending messages
Niklas Söderlund
niklas.soderlund at ragnatech.se
Sat Mar 13 00:20:33 CET 2021
Hi Kieran and Laurent,
On 2021-03-12 05:47:21 +0000, Kieran Bingham wrote:
> From: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
>
> Events may be queued to the pipeline handler between the pipeline
> handler entering the ::stop() function, and before the call to stop the
> IPA has completed.
>
> Handle these events by dispatching all pending messages at the proxy
> after the IPA has fully stopped.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> ---
> utils/ipc/generators/libcamera_templates/proxy_functions.tmpl | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl b/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl
> index 13dc8fdcab6e..8addc2fad0a8 100644
> --- a/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl
> +++ b/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl
> @@ -31,6 +31,8 @@
> thread_.exit();
> thread_.wait();
>
> + Thread::current()->dispatchMessages(Message::Type::InvokeMessage);
Is this not similar to the issue we have in cam? What if the events
processed here themself queue events will they be processed? I wonder if
the cleanest solution to all this would be to stop accepting messages as
the first step and return errors for all calls that would generate an
event. After we stopped accepting new events we can process the queue
until it's empty and once that is done we can stop the IPA.
Maybe it's overkill but at least we would make the race windows smaller
and easier to reproduce when found as they would only depend on the
content of the queue at stop().
> +
> running_ = false;
> {%- endmacro -%}
>
> --
> 2.25.1
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
--
Regards,
Niklas Söderlund
More information about the libcamera-devel
mailing list