summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bindings/samples/ave.c2
-rw-r--r--include/afb/afb-daemon-itf.h2
-rw-r--r--include/afb/afb-daemon-v1.h3
-rw-r--r--include/afb/afb-daemon-v2.h3
-rw-r--r--include/afb/afb-dynapi-itf.h1
-rw-r--r--include/afb/afb-dynapi.h3
-rw-r--r--src/afb-api-dyn.c4
-rw-r--r--src/afb-api-dyn.h1
-rw-r--r--src/afb-export.c6
9 files changed, 16 insertions, 9 deletions
diff --git a/bindings/samples/ave.c b/bindings/samples/ave.c
index a4b4144d..569245eb 100644
--- a/bindings/samples/ave.c
+++ b/bindings/samples/ave.c
@@ -483,7 +483,7 @@ int afbBindingVdyn(afb_dynapi *dynapi)
int i, rc;
for (i = 0; apis[i] ; i++) {
- rc = afb_dynapi_new_api(dynapi, apis[i], NULL, build_api, (void*)apis[i]);
+ rc = afb_dynapi_new_api(dynapi, apis[i], NULL, 0, build_api, (void*)apis[i]);
if (rc < 0)
AFB_DYNAPI_ERROR(dynapi, "can't create API %s", apis[i]);
}
diff --git a/include/afb/afb-daemon-itf.h b/include/afb/afb-daemon-itf.h
index b78f9af9..492032ee 100644
--- a/include/afb/afb-daemon-itf.h
+++ b/include/afb/afb-daemon-itf.h
@@ -44,7 +44,7 @@ struct afb_daemon_itf
struct afb_req (*unstore_req)(void*closure, struct afb_stored_req *sreq);
int (*require_api)(void*closure, const char *name, int initialized);
int (*rename_api)(void*closure, const char *name);
- int (*new_api)(void *closure, const char *api, const char *info, int (*preinit)(void*, struct afb_dynapi *), void *preinit_closure);
+ int (*new_api)(void *closure, const char *api, const char *info, int noconcurrency, int (*preinit)(void*, struct afb_dynapi *), void *preinit_closure);
};
/*
diff --git a/include/afb/afb-daemon-v1.h b/include/afb/afb-daemon-v1.h
index d1a0cc2a..d199a486 100644
--- a/include/afb/afb-daemon-v1.h
+++ b/include/afb/afb-daemon-v1.h
@@ -195,8 +195,9 @@ static inline int afb_daemon_new_api_v1(
struct afb_daemon daemon,
const char *api,
const char *info,
+ int noconcurrency,
int (*preinit)(void*, struct afb_dynapi *),
void *closure)
{
- return daemon.itf->new_api(daemon.closure, api, info, preinit, closure);
+ return daemon.itf->new_api(daemon.closure, api, info, noconcurrency, preinit, closure);
}
diff --git a/include/afb/afb-daemon-v2.h b/include/afb/afb-daemon-v2.h
index 1ea40e96..6eb48c60 100644
--- a/include/afb/afb-daemon-v2.h
+++ b/include/afb/afb-daemon-v2.h
@@ -171,9 +171,10 @@ static inline int afb_daemon_rename_api_v2(const char *name)
static inline int afb_daemon_new_api_v2(
const char *api,
const char *info,
+ int noconcurrency,
int (*preinit)(void*, struct afb_dynapi *),
void *closure)
{
- return afb_get_daemon_v2().itf->new_api(afb_get_daemon_v2().closure, api, info, preinit, closure);
+ return afb_get_daemon_v2().itf->new_api(afb_get_daemon_v2().closure, api, info, noconcurrency, preinit, closure);
}
diff --git a/include/afb/afb-dynapi-itf.h b/include/afb/afb-dynapi-itf.h
index 682558e0..fc90dbde 100644
--- a/include/afb/afb-dynapi-itf.h
+++ b/include/afb/afb-dynapi-itf.h
@@ -131,6 +131,7 @@ struct afb_dynapi_itf
void *dynapi,
const char *api,
const char *info,
+ int noconcurrency,
int (*preinit)(void*, struct afb_dynapi *),
void *closure);
diff --git a/include/afb/afb-dynapi.h b/include/afb/afb-dynapi.h
index dfdcdb24..e2458952 100644
--- a/include/afb/afb-dynapi.h
+++ b/include/afb/afb-dynapi.h
@@ -242,10 +242,11 @@ static inline int afb_dynapi_new_api(
struct afb_dynapi *dynapi,
const char *api,
const char *info,
+ int noconcurrency,
int (*preinit)(void*, struct afb_dynapi *),
void *closure)
{
- return dynapi->itf->api_new_api(dynapi, api, info, preinit, closure);
+ return dynapi->itf->api_new_api(dynapi, api, info, noconcurrency, preinit, closure);
}
static inline int afb_dynapi_set_verbs_v2(
diff --git a/src/afb-api-dyn.c b/src/afb-api-dyn.c
index 0667f519..2ef1b1a5 100644
--- a/src/afb-api-dyn.c
+++ b/src/afb-api-dyn.c
@@ -235,7 +235,7 @@ static struct afb_api_itf dyn_api_itf = {
.describe = describe_cb
};
-int afb_api_dyn_add(struct afb_apiset *apiset, const char *name, const char *info, int (*preinit)(void*, struct afb_dynapi*), void *closure)
+int afb_api_dyn_add(struct afb_apiset *apiset, const char *name, const char *info, int noconcurrency, int (*preinit)(void*, struct afb_dynapi*), void *closure)
{
int rc;
struct afb_api_dyn *dynapi;
@@ -266,7 +266,7 @@ int afb_api_dyn_add(struct afb_apiset *apiset, const char *name, const char *inf
/* records the binding */
afb_api.closure = dynapi;
afb_api.itf = &dyn_api_itf;
- afb_api.group = NULL;
+ afb_api.group = noconcurrency ? dynapi : NULL;
if (afb_apiset_add(apiset, afb_export_apiname(dynapi->export), afb_api) < 0) {
ERROR("dynamic api %s can't be registered to set %s, ABORTING it!",
afb_export_apiname(dynapi->export),
diff --git a/src/afb-api-dyn.h b/src/afb-api-dyn.h
index 35464c6e..21626eed 100644
--- a/src/afb-api-dyn.h
+++ b/src/afb-api-dyn.h
@@ -40,6 +40,7 @@ extern int afb_api_dyn_add(
struct afb_apiset *apiset,
const char *name,
const char *info,
+ int noconcurrency,
int (*preinit)(void*, struct afb_dynapi*),
void *closure);
diff --git a/src/afb-export.c b/src/afb-export.c
index 19aab0ce..ea783b8b 100644
--- a/src/afb-export.c
+++ b/src/afb-export.c
@@ -255,11 +255,12 @@ static int api_new_api_cb(
void *closure,
const char *api,
const char *info,
+ int noconcurrency,
int (*preinit)(void*, struct afb_dynapi *),
void *preinit_closure)
{
struct afb_export *export = closure;
- return afb_api_dyn_add(export->apiset, api, info, preinit, preinit_closure);
+ return afb_api_dyn_add(export->apiset, api, info, noconcurrency, preinit, preinit_closure);
}
/**********************************************
@@ -376,11 +377,12 @@ static int hooked_api_new_api_cb(
void *closure,
const char *api,
const char *info,
+ int noconcurrency,
int (*preinit)(void*, struct afb_dynapi *),
void *preinit_closure)
{
/* TODO */
- return api_new_api_cb(closure, api, info, preinit, preinit_closure);
+ return api_new_api_cb(closure, api, info, noconcurrency, preinit, preinit_closure);
}
/**********************************************
* vectors