diff options
author | Jose Bollo <jose.bollo@iot.bzh> | 2019-02-06 17:16:09 +0100 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2019-02-07 10:35:15 +0100 |
commit | 8b58a16a65f618fa0ca4f7707badc55649bc7f12 (patch) | |
tree | ff749bb9e9a1ce68733948ae94496237da242d6c /bindings/tutorial/tuto-4.c | |
parent | 4bb7ed656095229a1a91d19b9dbf172253c2532b (diff) |
jobs: Ensure releasing event loopguppy_6.99.5guppy/6.99.56.99.5
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 <jose.bollo@iot.bzh>
Diffstat (limited to 'bindings/tutorial/tuto-4.c')
-rw-r--r-- | bindings/tutorial/tuto-4.c | 29 |
1 files changed, 29 insertions, 0 deletions
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 <afb/afb-binding.h> + +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 +}; + |