Ack.
regards,
Anders Widell
On 01/02/2017 10:57 AM, Zoran Milinkovic wrote:
> osaf/libs/core/leap/sysf_def.c | 2 +-
> osaf/libs/core/leap/sysf_tmr.c | 23 ++++++++++++++++++-----
> 2 files changed, 19 insertions(+), 6 deletions(-)
>
>
> Fix sysfTmrCreate and return values.
>
> diff --git a/osaf/libs/core/leap/sysf_def.c b/osaf/libs/core/leap/sysf_def.c
> --- a/osaf/libs/core/leap/sysf_def.c
> +++ b/osaf/libs/core/leap/sysf_def.c
> @@ -95,7 +95,7 @@ uint32_t leap_env_init(void)
>
> #if (NCSL_ENV_INIT_TMR == 1)
> /* initialize LEAP Timer Service */
> - if (sysfTmrCreate() != NCSCC_RC_SUCCESS) {
> + if (!sysfTmrCreate()) {
> printf("\nleap_env_init: FAILED to initialize Timer Service\n");
> return NCSCC_RC_FAILURE;
> }
> diff --git a/osaf/libs/core/leap/sysf_tmr.c b/osaf/libs/core/leap/sysf_tmr.c
> --- a/osaf/libs/core/leap/sysf_tmr.c
> +++ b/osaf/libs/core/leap/sysf_tmr.c
> @@ -472,10 +472,9 @@ bool sysfTmrCreate(void)
> {
> NCS_PATRICIA_PARAMS pat_param;
> uint32_t rc = NCSCC_RC_SUCCESS;
> + bool prev_tmr_destroying;
>
> - if (ncs_tmr_create_done == false)
> - ncs_tmr_create_done = true;
> - else
> + if (ncs_tmr_create_done == true)
> return true;
>
> /* Empty Timer Service control block. */
> @@ -494,14 +493,19 @@ bool sysfTmrCreate(void)
>
> rc = ncs_patricia_tree_init(&gl_tcb.tmr_pat_tree, &pat_param);
> if (rc != NCSCC_RC_SUCCESS) {
> - return NCSCC_RC_FAILURE;
> + m_NCS_LOCK_DESTROY(&gl_tcb.safe.enter_lock);
> + m_NCS_LOCK_DESTROY(&gl_tcb.safe.free_lock);
> + return false;
> }
>
> rc = m_NCS_SEL_OBJ_CREATE(&gl_tcb.sel_obj);
> if (rc != NCSCC_RC_SUCCESS) {
> ncs_patricia_tree_destroy(&gl_tcb.tmr_pat_tree);
> - return NCSCC_RC_FAILURE;
> + m_NCS_LOCK_DESTROY(&gl_tcb.safe.enter_lock);
> + m_NCS_LOCK_DESTROY(&gl_tcb.safe.free_lock);
> + return false;
> }
> + prev_tmr_destroying = tmr_destroying;
> tmr_destroying = false;
>
> /* create expiry thread */
> @@ -515,17 +519,26 @@ bool sysfTmrCreate(void)
> 0,
> (char *)"OSAF_TMR",
> prio_val, policy, NCS_TMR_STACKSIZE,
> &gl_tcb.p_tsk_hdl) != NCSCC_RC_SUCCESS) {
> + tmr_destroying = prev_tmr_destroying;
> ncs_patricia_tree_destroy(&gl_tcb.tmr_pat_tree);
> m_NCS_SEL_OBJ_DESTROY(&gl_tcb.sel_obj);
> + m_NCS_LOCK_DESTROY(&gl_tcb.safe.enter_lock);
> + m_NCS_LOCK_DESTROY(&gl_tcb.safe.free_lock);
> return false;
> }
>
> if (m_NCS_TASK_START(gl_tcb.p_tsk_hdl) != NCSCC_RC_SUCCESS) {
> + tmr_destroying = prev_tmr_destroying;
> 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);
> + m_NCS_LOCK_DESTROY(&gl_tcb.safe.enter_lock);
> + m_NCS_LOCK_DESTROY(&gl_tcb.safe.free_lock);
> return false;
> }
> +
> + ncs_tmr_create_done = 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
>
------------------------------------------------------------------------------
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