This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: alarm


Paleologos Spanos wrote:
> 
>   Hi,I have some questions regarding the alarm trigerring.
> 
> -will the alarm be triggered after the completion of its thread?
>  If for example the execution of a thread lasts 30 ticks and I want to
> initialize the alarm to trigger every 50 ticks and invoke a function,will
> the alarm work on this case?or it is valid only during the execution of
> the thread in which it has been created?
> 
>  Actually I would like to know if the architecture I want to write is
> feasible or not.I want this:
> 
>  i have 2 threads(i have chosen bitmap scheduler) with different
> priorities.Assuming that thread1 lasts for 30 ticks and thread2 for 40
> ticks,I want to execute from the beginning again each thread.So I want to
> run thread1 every 70 ticks and thread 2 every 100 ticks.I do not care if
> these threads have completed their execution .I just want to restart them
> every  x ticks.
>  I had in mind that setting an alarm inside these 2 threads and
> initializing it to trigger every multiple of the above period could be a
> possible solution.So,for example the alarm in thread1 would be trigger
> every 100 ticks and would invoke the function(let's say) alarm_func1 which
> would kill and resume thread2.The same with the alarm in thread2.
> 
>  But I did it and it does not seem to be feasible.
>  What am I doing wrong?Is such an application possible with ecos?

Alarms are not associated with threads. They are independent entities. The
alarm handler functions are actually called in a DSR context, not a thread
context. And if you are killing off threads, be sure that the alarms were
not created on the thread stacks. Other than that, killing and resuming a
thread from an alarm handler _should_ work.

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Un cheval, pas du glue. Pas du cheval, beaucoup du glue. || Opinions==mine

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]