/* record it as an API */
afb_api.closure = api;
afb_api.itf = &dbus_api_itf;
- afb_api.noconcurrency = 0;
+ afb_api.group = NULL;
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_api.noconcurrency = 0;
+ afb_api.group = NULL;
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;
- 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;
xreq->context.api_key = api;
/* check self locking */
- if (!api->noconcurrency)
- api = NULL;
- else {
+ if (api->group) {
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);
/* 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");