Skip to contentSkip to conversation

difference between "alarm_wait" and "task_wait_period"

Xenomai-help Mouaiad Alras 2 participants 2 messages Apr 1, 2008 – Apr 9, 2008

lore
Share & tools
lore
#0 lore raw

Hello,
is there any difference between "periodic task" and "periodic alarm triggered task" ??

are "task1" and "task2" the same in this example ? :

void task1_do(void *cookies){
      while(1){
           rt_alarm_wait(&alarm1);
           ......
       }
}

int main(void){
......
rt_alarm_create(&alarm1,"alarm1"); rt_task_create(&task1,"task1",_STK,_PRIO,_MOD); rt_task_start(&task1, &task1_do, NULL); rt_alarm_start(&alarm1,_OFFSET,_INTERVAL);
......
}

===================================

void task2_do(void *cookies){
      while(1){
            rt_task_wait_period(&task2);
            ......
      }
}

int main(void){
......
rt_task_create(&task2,"task2",_STK,_PRIO,_MOD); rt_task_set_periodic(&task2,_OFFSET,_INTERVAL); rt_task_start(&task2, &task2_do, NULL);
......
}

thank you,

#1 lore raw
Quoted 5 lines · Mouaiad Alras

Hello,
is there any difference between "periodic task" and "periodic alarm triggered task" ??

are "task1" and "task2" the same in this example ? :

No, these are two ways to do the same thing. A periodic task uses a timer that is built-in the task, whereas an alarm creates a different timer. Of course, you can create as many alarms as you want whereas each task has only one built-in timer.

Signature · 1 line
					    Gilles.