Subject: Re: Improved timer code
To: Todd Whitesel <email@example.com>
From: Stefan Grefen <firstname.lastname@example.org>
Date: 10/26/1998 10:29:52
In message <199810250427.VAA19039@shell17.ba.best.com> Todd Whitesel wrote:
> > Just FYI, FreeBSD is contemplating changing our API one more time to have
> > timeout take a callout handle. This will allow us to get rid of the
> > static allocation of callout entries (which you could also do simply by
> > tacking on the use of a pool or zone allocator to the current FreeBSD
> > interface), but more importantly, will allow clients to perform upfront
> > allocation of callout resources rather than add complicated error recovery
> > for failed allocations in an interrupt context.
> I once worked on a standalone crt0 layer that had many optional features
> and needed its own atexit() system, and I must say that the caller-allocates
> model is far superior any time it does not conflict with something else you
> need to do.
Well sometimes it's more convenient to let the system allocate the entry
and safer if it's hard to control the lifetime of the object containing the
In interrupt context or for heavy use, pre-allocating is always a good idea,
ecause dealing with a failure is a royal pain and allocatining an (the same)
entry over and again hurts performance.
For most uses it just doesn't matter :-)
How about adding a pointer arg to timeout, but if it's value is NULL
the system allocates the entry (and marks it or calls a special timeout
function to free it).
Of cause this requires timeout to return a pointer to the structure.
> Todd Whitesel
> toddpw @ best.com
Stefan Grefen Tandem Computers Europe Inc.
email@example.com High Performance Research Center
--- Hacking's just another word for nothing left to kludge. ---