Change-Id: Iafbbff8387bb1f8577cb7aeb6e8ed4b14ab1f4a4
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
/* record it as an API */
afb_api.closure = api;
afb_api.itf = &dbus_api_itf;
/* record it as an API */
afb_api.closure = api;
afb_api.itf = &dbus_api_itf;
- afb_api.noconcurrency = 0;
if (afb_apiset_add(apiset, api->api, afb_api) < 0)
goto error2;
if (afb_apiset_add(apiset, api->api, afb_api) < 0)
goto error2;
afb_export_rename(desc->export, desc->binding->v1.prefix);
afb_api.closure = desc;
afb_api.itf = &so_v1_api_itf;
afb_export_rename(desc->export, desc->binding->v1.prefix);
afb_api.closure = desc;
afb_api.itf = &so_v1_api_itf;
- afb_api.noconcurrency = 0;
if (afb_apiset_add(apiset, afb_export_apiname(desc->export), afb_api) < 0) {
ERROR("binding [%s] can't be registered...", path);
goto error;
if (afb_apiset_add(apiset, afb_export_apiname(desc->export), afb_api) < 0) {
ERROR("binding [%s] can't be registered...", path);
goto error;
/* records the binding */
afb_api.closure = desc;
afb_api.itf = &so_v2_api_itf;
/* records the binding */
afb_api.closure = desc;
afb_api.itf = &so_v2_api_itf;
- afb_api.noconcurrency = binding->noconcurrency;
+ afb_api.group = binding->noconcurrency ? export : NULL;
if (afb_apiset_add(apiset, afb_export_apiname(desc->export), afb_api) < 0) {
ERROR("binding %s can't be registered to set %s...", afb_export_apiname(desc->export), afb_apiset_name(apiset));
goto error;
if (afb_apiset_add(apiset, afb_export_apiname(desc->export), afb_api) < 0) {
ERROR("binding %s can't be registered to set %s...", afb_export_apiname(desc->export), afb_apiset_name(apiset));
goto error;
{
void *closure;
struct afb_api_itf *itf;
{
void *closure;
struct afb_api_itf *itf;
- unsigned noconcurrency: 1;
};
extern int afb_api_is_valid_name(const char *name);
};
extern int afb_api_is_valid_name(const char *name);
assert(!stubws->listener); /* check client */
api.closure = stubws;
api.itf = &ws_api_itf;
assert(!stubws->listener); /* check client */
api.closure = stubws;
api.itf = &ws_api_itf;
xreq->context.api_key = api;
/* check self locking */
xreq->context.api_key = api;
/* check self locking */
- if (!api->noconcurrency)
- api = NULL;
- else {
caller = xreq->caller;
while (caller) {
caller = xreq->caller;
while (caller) {
- if (caller->context.api_key == api) {
+ if (((const struct afb_api *)caller->context.api_key)->group == api->group) {
/* noconcurrency lock detected */
ERROR("self-lock detected in call stack for API %s", xreq->api);
early_failure(xreq, "self-locked", "recursive self lock, API %s", xreq->api);
/* noconcurrency lock detected */
ERROR("self-lock detected in call stack for API %s", xreq->api);
early_failure(xreq, "self-locked", "recursive self lock, API %s", xreq->api);
/* queue the request job */
afb_xreq_unhooked_addref(xreq);
/* queue the request job */
afb_xreq_unhooked_addref(xreq);
- if (jobs_queue(api, afb_apiset_timeout_get(apiset), process_async, xreq) < 0) {
+ if (jobs_queue(api->group, afb_apiset_timeout_get(apiset), process_async, xreq) < 0) {
/* TODO: allows or not to proccess it directly as when no threading? (see above) */
ERROR("can't process job with threads: %m");
early_failure(xreq, "cancelled", "not able to create a job for the task");
/* TODO: allows or not to proccess it directly as when no threading? (see above) */
ERROR("can't process job with threads: %m");
early_failure(xreq, "cancelled", "not able to create a job for the task");