grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Implement grub_sleep() and grub_ticksleep()


From: Robert Millan
Subject: Re: [PATCH] Implement grub_sleep() and grub_ticksleep()
Date: Fri, 19 Oct 2007 14:38:17 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

On Wed, Oct 17, 2007 at 12:33:49PM +0200, Marco Gerards wrote:
> >     * kern/i386/efi/init.c: Include `grub/time.h'.
> 
> <grub/time.h> is preferred.

Fixed.

> > +void
> > +grub_millisleep_generic (grub_uint32_t ms)
> > +{
> > +  grub_uint32_t time;
> > +  int i;
> > +
> > +  for (; ms > 0; ms -= TICK_DURATION_IN_MS)
> > +    /* wait for the lowest fraction of milliseconds we can (rounded up) */
> > +    for (i = 0; i < TICK_DURATION_IN_MS; i++)
> > +      {
> > +   /* wait for next tick */
> > +   time = grub_get_rtc ();
> > +   while (time == grub_get_rtc ())
> > +     grub_cpu_idle ();
> > +      }
> > +}
> 
> The problem with this is when TICK_DURATION_IN_MS is not very
> accurate.  I think you can be more accurate if you use
> TICKS_PER_SECOND and use it to calculate the total amount of ticks to
> wait.  This will avoid rounding problems.  Accuracy is not always that
> important, but I prefer to have it, if we can.

Fixed, I think.

Attached new patch.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)

Attachment: time.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]