Hi Ramesh,

Seems that there is some issue with the timer.
I'm not getting working the timer correctly all the time.
I was talking with Anders W. this week to use conditional variables to sync 
timer thread with other threads.

To reproduce the timer problem, just simply run the unit test for timers.

I will republish the patch next week.

BR,
Zoran

-----Original Message-----
From: ramesh betham [mailto:[email protected]] 
Sent: den 19 januari 2017 12:27
To: Zoran Milinkovic <[email protected]>
Cc: Anders Widell <[email protected]>; 
[email protected]
Subject: Re: [devel] [PATCH 1 of 1] base: synchronize timer thread with the 
main thread [#2248]

Hi,

I am not able to correlate this patch with the problem description of #2248.

I see the changes mentioned in the patch are not required. Probably need to do 
more evaluation why the test hangs forever for SysfTmrTest.TestIntervalTimer. 
Any supporting logs?

Thanks,
Ramesh.

On 1/10/2017 6:48 PM, Anders Widell wrote:
> Hi!
>
> I don't understand this patch. To me it looks like both the timer 
> thread and the main thread will be waiting on the same selection 
> object (gl_tcb.sel_obj). Shouldn't a separate selection object be used 
> to synchronize thread start-up, to avoid a race here? Secondly, I 
> don't understand why we need this synchronization in the first place.
> Shouldn't the timer functions work no matter if the timer thread is 
> running or not? Of course, no timer will expire until the timer thread 
> has started, but it should be possible to create timers regardless of 
> whether the thread is running or not.
>
> regards,
>
> Anders Widell
>
> On 01/03/2017 04:42 PM, Zoran Milinkovic wrote:
>>   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
>>
>


------------------------------------------------------------------------------
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

Reply via email to