summaryrefslogtreecommitdiff
path: root/utils/ipc/generators
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-03-12 04:04:29 +0000
committerKieran Bingham <kieran.bingham@ideasonboard.com>2021-03-24 09:24:06 +0000
commitf041482add7c3a78b9342447cbda98f856c5a7aa (patch)
tree07740f0726b0b02f92f6cf1d0b3ad20b7559fa5f /utils/ipc/generators
parentc7dd9655e5e0a95e3a776eb92f54841a68b82331 (diff)
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>
Diffstat (limited to 'utils/ipc/generators')
-rw-r--r--utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl2
-rw-r--r--utils/ipc/generators/libcamera_templates/proxy_functions.tmpl4
2 files changed, 4 insertions, 2 deletions
diff --git a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl
index f75b1206..e3b541db 100644
--- a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl
+++ b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl
@@ -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}});
}
diff --git a/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl b/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl
index c2ac42fc..13dc8fdc 100644
--- a/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl
+++ b/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl
@@ -26,12 +26,12 @@
if (!running_)
return;
- running_ = false;
-
proxy_.invokeMethod(&ThreadProxy::stop, ConnectionTypeBlocking);
thread_.exit();
thread_.wait();
+
+ running_ = false;
{%- endmacro -%}