This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: alarm
- To: Paleologos Spanos <paleolog at ee dot ucla dot edu>
- Subject: Re: [ECOS] alarm
- From: Jonathan Larmour <jlarmour at redhat dot com>
- Date: Fri, 19 Jan 2001 03:56:54 +0000
- Cc: ecos-discuss at sources dot redhat dot com
- Organization: Red Hat UK Ltd.
- References: <Pine.GSO.4.10.10101181919440.18453-100000@sierra.ee.ucla.edu>
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