Hi,

>
> > I also have tried
> >
> >        struct timespec period;
> >        period.tv_sec=0;
> >        period.tv_nsec=PERIOD;
> >
> >         clock_gettime      ( CLOCK_REALTIME, &now);
> >         pthread_make_periodic_np (pthread_self(), &now,&period);
> >
> > Although both compile and execute, non of them works fine to me. Any clue
> ?
>
> Here I have no clue, more exactly, I would need to see the whole code to
> see what is going wrong. But again, checking pthread_make_periodic_np
> return value, and looking at the documentation would help. My guess
> would be that at the time of pthread_make_periodic_np, "now" is a date
> in the past.
>

Yes !!! You are completelly right !!

I was following RTLinux scheme and that made me to fail.
Current code is :

clock_gettime      ( TIMER_ABSTIME, &now);
now.tv_nsec=now.tv_nsec+PERIOD;
out=pthread_make_periodic_np (pthread_self(), &now,&period);
       switch(out){
         case 0 :
          break;
         case ESRCH:
        printf("thread is invalid \n");
        pthread_exit ((void *)-1);
          break;
         case ETIMEDOUT :
        printf("the start time has already passed\n");
        pthread_exit ((void *)-1);
          break;
         default :
        printf(" output value not defined \n");
            pthread_exit ((void *)-1);
    }




>
> And pthread_make_periodic_np/pthread_wait_np are supposed to help
> porting code from RTLinux, they should not be used in new programs. You
> should be using clock_gettime with the TIMER_ABSTIME flag.
>

This is very useful for porting from RTLinux which is exactly what I'm
doing.

Any suggestion to substitute pthread_make_periodic_np and  pthread_wait_np
in a POSIX skin ?



Thank you very much
Ramon
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to