The binder was sometime locked until an external
event comes. This was discovered during stressing
startup test that don't expect external inputs and
that then waits for always without terminating.
The issue came from a little hole in the management
of the state of evmgr object. By design the evmgr
has to be synchronised against concurrent accesses
not by itself but by the integration. However, the
state of "running" wasn't set in the code protected
against concurent accesses. The new function allows
the integrator to correctly set the state before
releasing protection.
Bug-AGL: SPEC-2459
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Change-Id: Id75fd97c06d69666ced912a0a61380573dab31af
#define EVLOOP_STATE_WAIT 1U
#define EVLOOP_STATE_RUN 2U
#define EVLOOP_STATE_WAIT 1U
#define EVLOOP_STATE_RUN 2U
+/**
+ * prepare the evmgr to run
+ */
+void evmgr_prepare_run(struct evmgr *evmgr)
+{
+ evmgr->state = EVLOOP_STATE_WAIT|EVLOOP_STATE_RUN;
+}
+
/**
* Run the event loop is set.
*/
/**
* Run the event loop is set.
*/
+extern void evmgr_prepare_run(struct evmgr *evmgr);
extern void evmgr_run(struct evmgr *evmgr);
extern void evmgr_job_run(int signum, struct evmgr *evmgr);
extern int evmgr_can_run(struct evmgr *evmgr);
extern void evmgr_run(struct evmgr *evmgr);
extern void evmgr_job_run(int signum, struct evmgr *evmgr);
extern int evmgr_can_run(struct evmgr *evmgr);
abort();
}
/* run the events */
abort();
}
/* run the events */
+ evmgr_prepare_run(evmgr);
pthread_mutex_unlock(&mutex);
sig_monitor(0, (void(*)(int,void*))evmgr_job_run, evmgr);
pthread_mutex_lock(&mutex);
pthread_mutex_unlock(&mutex);
sig_monitor(0, (void(*)(int,void*))evmgr_job_run, evmgr);
pthread_mutex_lock(&mutex);