On Fri, Jun 23, 2000 at 10:58:02AM -0400, Paul Jacyk wrote:
> Hi,
> 
> In RTLinux 3.0pre6 the function usleep is now present in rti_sched.c. I
> was wondering what, if any, troubles there would be by the addition of a
> nanosleep function (see code based on usleep).  It seems like there
> might be a hardware related resolution problem (ticks ?) or something

Basically, we don't see systems yet where nano means anything practical.
You could easily deifne 
naonsleep(i) by  usleep(i*1000) and not notice a difference.

Your version is fine too. PErhaps it would be smartfor us to redefine 
usleep(i) as nanosleep(i/1000)


> else (time spent creating the new thread ?) that would make this
> approach a bad idea since the times could be much smaller than in
> usleep.
> 
> just changed the line
>         th->resume_time = gethrtime() + HRT_FROM_NS(interval * 1000);
> to
>         th->resume_time = gethrtime() + HRT_FROM_NS(interval);
> 
> int nanosleep (nanoseconds_t interval)
> {
>         rtl_irqstate_t flags;
>         pthread_t th = pthread_self();
>         hrtime_t save_resume_time;
> 
>         rtl_no_interrupts (flags);
>         save_resume_time = th->resume_time;
> 
>         th->resume_time = gethrtime() + HRT_FROM_NS(interval);
>         th->state = RTL_THREAD_DELAYED;
>         rtl_schedule_cancelable();
> 
>         th->resume_time = save_resume_time;
>         rtl_restore_interrupts (flags);
>         return 0;
> }
> 
> Thanks,
> Paul
> 
> 
> -- [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/rtlinux/

-- 
---------------------------------------------------------
Victor Yodaiken 
FSMLabs:  www.fsmlabs.com  www.rtlinux.com
FSMLabs is a servicemark and a service of 
VJY Associates L.L.C, New Mexico.

-- [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/rtlinux/

Reply via email to