utils: ipc: proxy: Assert asynchronous calls execute in the running state

Signals and calls from the IPA should not occur after the IPA has been
put into the stopped state.

Add assertions to catch and prevent any messages being processed after
this.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Laurent Pinchart 2021-03-12 04:04:29 +00:00 committed by Kieran Bingham
parent c7dd9655e5
commit f041482add
2 changed files with 4 additions and 2 deletions

View file

@ -173,6 +173,7 @@ void {{proxy_name}}::recvMessage(const IPCMessage &data)
{%- endfor -%}
);
{% elif method|is_async %}
ASSERT(running_);
proxy_.invokeMethod(&ThreadProxy::{{method.mojom_name}}, ConnectionTypeQueued,
{%- for param in method|method_param_names -%}
{{param}}{{- ", " if not loop.last}}
@ -225,6 +226,7 @@ void {{proxy_name}}::recvMessage(const IPCMessage &data)
{% for method in interface_event.methods %}
{{proxy_funcs.func_sig(proxy_name, method, "Thread")}}
{
ASSERT(running_);
{{method.mojom_name}}.emit({{method.parameters|params_comma_sep}});
}

View file

@ -26,12 +26,12 @@
if (!running_)
return;
running_ = false;
proxy_.invokeMethod(&ThreadProxy::stop, ConnectionTypeBlocking);
thread_.exit();
thread_.wait();
running_ = false;
{%- endmacro -%}