Skip to contentSkip to conversation

Problems with rt_task_wait_period

Xenomai-help Steve Kreyer 1 participant 1 message Aug 7, 2006

lore
Share & tools
lore
#0 lore raw

Hi,

thanks for your answers that sounds plausible to me :)
But another problem arises:
If I inrease the period from 100 to 1000000 ns in the posted program, I get a system crash :)

Regards,

Steve

-----Ursprüngliche Nachricht-----
Von: [email protected]
Gesendet: 07.08.06 16:13:39
An: Jan Kiszka <[email protected]>
CC: [email protected]
Betreff: Re: [Xenomai-help] Problems with rt_task_wait_period

Quoted 13 lines · Jan Kiszka
Quoted 12 lines · Steve Kreyer

Hi,

Iam new to xenomai.
For warming up I try to run this little test program:

-----------------------------------------------------------------------
#include <native/task.h>
#include <stdio.h>
#include <sys/mman.h>

RT_TASK task1;

Quoted 8 lines
Quoted 3 lines
void rt_task1(void* user_data){
    int err = 0;
    printf("%d\n", rt_task_set_periodic(NULL, TM_NOW, 100));

You are running in one-shot mode, thus all time units are in *nanoseconds*. 100 ns cycles tend to pass quite quickly, thus the setup actually fails (but it doesn't report this - a corner case for considering this a bug).

The setup does not really fail, but the period is so short that the tick occurs before the task has a chance to wait for the first release point in the timeline, so rt_task_wait_period() notices that no timer is outstanding, but incorrectly concludes that no timer was ever armed.

Quoted 34 lines
Quoted 19 lines
    err = rt_task_wait_period(NULL);
    if(err){
        fprintf(stderr, "Cannot wait periodic: %d, %d\n", err, EWOULDBLOCK);

    }
}
int main(){
    char* task1_data = NULL;
    mlockall(MCL_CURRENT|MCL_FUTURE);
    rt_timer_set_mode(TM_ONESHOT);
    rt_task_spawn(&task1, "task1", 0, 99, 0, rt_task1, &task1_data);
    sleep(10);
    rt_task_delete(&task1);
    return 0;
}

-----------------------------------------------------------------------

Quoted 8 lines

But rt_task_wait_period gives me always the Error EWOULDBLOCK, which means that I did not set the task periodic but which in fact I did... The call to rt_task_set_periodic is succesful.
Can anyone help me figure out why? If you need additional infos please let me know...

Thanks in advance!

Steve

Jan

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Signature · 8 lines
Philippe.




__________________________________________________________________________
Erweitern Sie FreeMail zu einem noch leistungsstärkeren E-Mail-Postfach!		
Mehr Infos unter http://freemail.web.de/home/landingpad/?mc=021131