src/base/sysf_tmr.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
sysfTmrCreate() will wait for max 1 second for the timer thread to be fully
ready to start timers.
diff --git a/src/base/sysf_tmr.c b/src/base/sysf_tmr.c
--- a/src/base/sysf_tmr.c
+++ b/src/base/sysf_tmr.c
@@ -402,6 +402,10 @@ static uint32_t ncs_tmr_wait(void)
ts_current = ts_start;
+ /* Send the first indication to the selection object
+ * to synchronize threads */
+ m_NCS_SEL_OBJ_IND(&gl_tcb.sel_obj);
+
while (true) {
set.fd = m_GET_FD_FROM_SEL_OBJ(gl_tcb.sel_obj);
set.events = POLLIN;
@@ -526,6 +530,18 @@ bool sysfTmrCreate(void)
m_NCS_SEL_OBJ_DESTROY(&gl_tcb.sel_obj);
return false;
}
+
+ /* Wait for max 1 sec for ncs_tmr_wait() to be fully ready.
+ * The function fails if the timer thread is not ready within 1 sec */
+ rc = osaf_poll_one_fd(gl_tcb.sel_obj.rmv_obj, 1000);
+ if(rc != 1) {
+ m_NCS_TASK_RELEASE(gl_tcb.p_tsk_hdl);
+ ncs_patricia_tree_destroy(&gl_tcb.tmr_pat_tree);
+ m_NCS_SEL_OBJ_DESTROY(&gl_tcb.sel_obj);
+ return false;
+ }
+ m_NCS_SEL_OBJ_RMV_IND(&gl_tcb.sel_obj, true, true);
+
return true;
}
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel