pthread_make_periodic_np initial start date
Is there a way to specify no initial delay when calling pthread_make_periodic_np? If I pass a value directly obtained from clock_gettime, it will return a ETIMEDOUT error due to time passing before I make the call. I could add a small delay to the value obtained from clock_gettime, but I would be concerned that due to other happenings in the system, the absolute date may still have passed by the time it gets around to calling pthread_make_periodic_np.
What I would be looking for I guess is what happens when I call rt_task_set_periodic with an idate parameter of TM_NOW. Is there any way to simulate this behavior?
Thanks.
Quoted 11 lines · Steve Deiters
Is there a way to specify no initial delay when calling
pthread_make_periodic_np? If I pass a value directly obtained fromclock_gettime, it will return a ETIMEDOUT error due to time passing before I make the call. I could add a small delay to the value obtained fromclock_gettime, but I would be concerned that due to other happenings in the system, the absolute date may still have passed by the time it gets around to callingpthread_make_periodic_np.What I would be looking for I guess is what happens when I call
rt_task_set_periodicwith an idate parameter ofTM_NOW. Is there any way to simulate this behavior?
pthread_make_periodic_np is a legacy from RTLinux. You should be using clock_nanosleep instead.
That said, pthread_make_periodic_np internally uses the same service as rt_task_set_periodic, and TM_NOW is just 0. So, you can probably pass a timespec with tv_sec and tv_nsec both 0.
Signature · 1 line
Gilles.