If you have a 2 second deadline and a routine that takes,
say, 150 milliseconds to execute, then set the sleep for
1.85 seconds and you'll meet your deadline. Unfortunately
there is nothing that I've found any more sophisticated
than this in RTLinux.
Norm
----- Original Message -----
From: Massimiliano Cialdi <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, November 24, 2001 4:48 AM
Subject: Re: [rtl] oneshot thread
> Der Herr Hofrat wrote:
> >
> > > What do I need if I don't want a periodic thread?
> > > That is, I want to set a dead-line for my thread
without using periodic
> > > thread?
> > >
> >
> > next_time=calc_time(); /* calculate the next time you
want to run in NS */
> > now=clock_gethrtime(); /* get the current time */
> >
> > while(1){
> >
clock_nanosleep(CLOCK_REATLTIME,TIMER_ABSTIME,hrt2ts(now+ne
xt_time),NULL);
> >
> > < your rt code >
> >
> > next_time=calc_time();
> > now=clock_gethrtime();
> > }
> I don't understand...
> I read the man page for clock_nanosleep(). It says it
suspends execution
> of a thread.
> If I set a dead line after 2s I would like it had
finished at least in
> 2s.
> Your code seems to wait 2s and then it executes rt
code...
>
> thanks
> --
> Massimiliano Cialdi
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> echo "unsubscribe rtl <Your_email>" | mail
[EMAIL PROTECTED]
> --
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/
>
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/