aboutsummaryrefslogtreecommitdiffstats
path: root/src/afb-common.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-03-30 13:33:11 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-03-30 13:33:11 +0200
commit89c44a872117fb8f64d38cbccf8f36776f2623f6 (patch)
tree89b26e67440c1f6f77fc6c1fcdeccf3b1ea1fb37 /src/afb-common.c
parent391ada39d89f9f90d186aed8e1d825be9c17a328 (diff)
Fix concurrency issues on event manager
Having only one event manager is not possible in multithreading due to the way that systemd has to manage timer events. We observed that timers were not armed when set in a thread because event was polling in an other thread. This patch provides more than one event manager and at most as many as the number of threads avalaible to start. Change-Id: Iaeab353b7bc79ce61361ab73c7b197a9e69a6109 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-common.c')
-rw-r--r--src/afb-common.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/afb-common.c b/src/afb-common.c
index 47ba40f7..087a6285 100644
--- a/src/afb-common.c
+++ b/src/afb-common.c
@@ -27,6 +27,7 @@
#include "afb-common.h"
#include "locale-root.h"
+#include "jobs.h"
static const char *default_locale = NULL;
static struct locale_root *rootdir = NULL;
@@ -42,7 +43,6 @@ struct sd_event *afb_common_get_thread_event_loop()
}
return result;
}
-*/
static void *sdopen(void **p, int (*f)(void **))
{
@@ -55,6 +55,7 @@ static void *sdopen(void **p, int (*f)(void **))
}
return *p;
}
+*/
static struct sd_bus *sdbusopen(struct sd_bus **p, int (*f)(struct sd_bus **))
{
@@ -77,8 +78,7 @@ static struct sd_bus *sdbusopen(struct sd_bus **p, int (*f)(struct sd_bus **))
struct sd_event *afb_common_get_event_loop()
{
- static struct sd_event *result = NULL;
- return sdopen((void*)&result, (void*)sd_event_new);
+ return jobs_get_sd_event();
}
struct sd_bus *afb_common_get_user_bus()