public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] cyg_alarm
@ 2001-01-22 14:05 Paleologos Spanos
  0 siblings, 0 replies; 3+ messages in thread
From: Paleologos Spanos @ 2001-01-22 14:05 UTC (permalink / raw)
  To: ecos-discuss

 Hi,I have a problem concerning the alarm's function.
 I have 2 threads which are containing an alarm each.I have set these 2
alarms so as every 5000 ticks  the alarm in thread 1 to trigger a
function
which will kill and resume thread 2.With the same way the alarm in thread
2 is set so as to trigger a function which kills and resumes thread1 every
3500 ticks.I have noticed haowever a strange behaviour of the threads.

 1)The threads are not killed at the desired time points.I would expect to
see the thread1(highest priority) to start every 3500 ticks(at
3500,7000,10500 ,etc..)



 2)the threads do not stop their execution at these points.I mean that if
the thread 1 is a counter from 1-100 ,The output still be a counter from
1-100 .I would expect that sometimes it would be stopped at 80 or 47 or
any number it had counted until the point of killing.That means that the
thread is not killed, right? 

 I am using the below code inside the thread:
    THREAD 
{
   ...
   ... 
  cyg_clock_to_counter(cyg_real_time_clock(),..);
  cyg_alarm_create(..,         );
  cyg_alarm_initialize(..  ,cyg_current_time()+3500,3500);

void test_alarm_func2(cyg_handle_t alarmH2,cyg_addrword_t data2)
{
        cyg_thread_kill(simple_threadA);
        cyg_thread_resume(simple_threadA);
}

 After this I would expect  that the other thread should restart every
3500 ticks.

  What am I doing wrong.Do I have misunderstood something?


  Thank you for your interest in advance. 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] Cyg_Alarm
  2003-07-02 10:52 [ECOS] Cyg_Alarm Matthieu.GIRARDIN
@ 2003-07-03 14:32 ` Nick Garnett
  0 siblings, 0 replies; 3+ messages in thread
From: Nick Garnett @ 2003-07-03 14:32 UTC (permalink / raw)
  To: Matthieu.GIRARDIN; +Cc: ecos-discuss

Matthieu.GIRARDIN@fr.thalesgroup.com writes:

> Hi,
> 
> Is it possible to destroy an alarm ( cyg_alarm_destroy(handle) ) in the
> fonction executed by its fonction ?
> 
> In fact, I try to free the alarm automaticaly when the tempo has finished.
> So I free and re-initialize my structure at the end of its code (which
> happens once because it's a tempo not an clock).
> 
> Is it not a problem or a snake which is eating its queue ... 
> 

This ought to work. Let me know if it does not.

-- 
Nick Garnett                    eCos Kernel Architect
http://www.ecoscentric.com/     The eCos and RedBoot experts


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ECOS] Cyg_Alarm
@ 2003-07-02 10:52 Matthieu.GIRARDIN
  2003-07-03 14:32 ` Nick Garnett
  0 siblings, 1 reply; 3+ messages in thread
From: Matthieu.GIRARDIN @ 2003-07-02 10:52 UTC (permalink / raw)
  To: ecos-discuss

Hi,

Is it possible to destroy an alarm ( cyg_alarm_destroy(handle) ) in the
fonction executed by its fonction ?

In fact, I try to free the alarm automaticaly when the tempo has finished.
So I free and re-initialize my structure at the end of its code (which
happens once because it's a tempo not an clock).

Is it not a problem or a snake which is eating its queue ... 

Best regards 

Matthiue GIRARDIN

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-07-03 14:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-22 14:05 [ECOS] cyg_alarm Paleologos Spanos
2003-07-02 10:52 [ECOS] Cyg_Alarm Matthieu.GIRARDIN
2003-07-03 14:32 ` Nick Garnett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).