Subject: Re: Preparing callout(9) for a HZ-less kernel
To: None <tech-kern@netbsd.org>
From: Andrew Doran <ad@netbsd.org>
List: tech-kern
Date: 10/19/2007 01:38:43
On Thu, Oct 18, 2007 at 11:47:33PM +0200, Joerg Sonnenberger wrote:
> On Thu, Oct 18, 2007 at 10:43:11PM +0100, Andrew Doran wrote:
> > ltsleep/mtsleep are obsoleted by condvars for most uses. I now think I made
> > a mistake with the condvars and that they should accept an absolute wakeup
> > time instead of a delta. That's easy enough to do except for handling the
> > effects of changing the system clock.
> 
> I think the delta in itself is fine, just the measurement is wrong. I
> would like to adopt the cv_wait API to use similiar precision as well.

Consider:

	user provides a timeout value
	enter timed sleep waiting for a condition to become true
	wake up early, find that the condition is still not true
	go back to sleep re-using the same timeout value

If we pass an absolute wakeup time to the sleep routine then the above will
not sleep longer than requested.

Thanks,
Andrew