New "timeout" api, to replace callout

Luigi Rizzo rizzo at icir.org
Sun Dec 2 11:06:40 PST 2007


On Sun, Dec 02, 2007 at 05:43:54PM +0000, Poul-Henning Kamp wrote:
> In message <20071202.093603.228972203.imp at bsdimp.com>, "M. Warner Losh" writes:
> >In message: <19827.1196612123 at critter.freebsd.dk>
> >            "Poul-Henning Kamp" <phk at phk.freebsd.dk> writes:
> >: In message <20071202.085545.177225588.imp at bsdimp.com>, "M. Warner Losh" writes:
> >: 
> >: >There are a number of places in the tree that use a parameter of '1'
> >: >today to mean "next time that's convenient."  Some of these places are
> >: >clever and know that HZ is never < 100 or > 1000 (or so they think),
> >: >while others are just sloppy code.
> >: 
> >: Yes, but those can hardly be called "concrete" in terms of wanting
> >: to know what they mean, can they ? :-)
> >: 
> >: The only way I can see we can deal with them in the short term,
> >: is to ask for timeouts of "1000000 / hz, TIMEOUT_USEC"
> >
> >Or have a "timeout_soon" function like you have the other timeout
> >conversion routines.
> 
> I'm not very keen on offering too much rope.
> 
> Intelligent decisions need to be made about these polling rates and
> making it too easy to not think about it would be to encourage
> bad practices.

the approach 'no less than N, preferably* no more than M' {n|u|m}seconds
that phk suggested looks to me like the correct approach. The programmer
can make his assumptions explicit, and the system can make convenient
decisions without making arbitrary assumptions.

cheers
luigi


More information about the freebsd-arch mailing list