From 74f381d988cd04707c2044ca2a201ad8bf87a6f3 Mon Sep 17 00:00:00 2001 From: Jose Bollo Date: Wed, 6 Feb 2019 17:16:09 +0100 Subject: jobs: Ensure releasing event loop The internal functions blocking threads for implementing call_sync were not releasing the event loop, leading to deafness of the binder. Include a tuto-4 that reproduce the issue on a binder with the bug and that also shows interesting usages of the binder. Bug-AGL: SPEC-2161 Change-Id: I83ad4d55d721a6046e798a5e06967df4dd5a7284 Signed-off-by: Jose Bollo --- bindings/tutorial/CMakeLists.txt | 1 + bindings/tutorial/tuto-4.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 bindings/tutorial/tuto-4.c (limited to 'bindings') diff --git a/bindings/tutorial/CMakeLists.txt b/bindings/tutorial/CMakeLists.txt index 2860c8c9..babc4c6c 100644 --- a/bindings/tutorial/CMakeLists.txt +++ b/bindings/tutorial/CMakeLists.txt @@ -32,3 +32,4 @@ ENDMACRO(tuto) tuto(1 c) tuto(2 c) tuto(3 cpp) +tuto(4 c) diff --git a/bindings/tutorial/tuto-4.c b/bindings/tutorial/tuto-4.c new file mode 100644 index 00000000..cb909fd0 --- /dev/null +++ b/bindings/tutorial/tuto-4.c @@ -0,0 +1,29 @@ +#define AFB_BINDING_VERSION 3 +#include + +void hello(afb_req_t req) +{ + AFB_REQ_DEBUG(req, "hello world"); + afb_req_reply(req, NULL, NULL, "hello world"); +} + +const afb_verb_t verbs[] = { + { .verb="hello", .callback=hello }, + { .verb=NULL } +}; + + +static int init(afb_api_t api) +{ + int rc = afb_api_require_api(api, "hello", 1); + if (!rc) + rc = afb_api_call_sync(api, "hello", "ping", NULL, NULL, NULL, NULL); + return rc; +} + +const afb_binding_t afbBindingExport = { + .api = "tuto-4", + .verbs = verbs, + .init = init +}; + -- cgit 1.2.3-korg