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]

cyg_alarm


 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. 


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