Subject: Re: Callouts
To: Charles M. Hannum <firstname.lastname@example.org>
From: Greg Hudson <ghudson@MIT.EDU>
Date: 03/27/1999 11:53:01
> (It's worth noting that if the caller wants to be able to delete the
> timeout from the heap, it must get a handle back. The form of that
> handle is quite flexible, however; it would probably be some integer
> combination of the level and index, as this information is needed to
> do the removal and would be annoying to derive.
If I understand you right, this wouldn't work. The level and position
of any given timer in a heap structure can change each time the first
timer goes off.
[The rest is rambling.]
When I did a timer queue as a heap, I passed back pointers to the
timer structures as handles, and each timer knew its own index back
into the heap. I could update that index whenever I moved a timer
around. But that only works because I had a heap of pointers to timer
structures; I believe you wanted a heap of the timer structures
themselves, in which case a pointer to a timer structure will become
invalid just as fast as the row and position.
It's much easier if you can get away with not allowing removal, or can
make the removal operation expensive, but I assume that's not