Subject: Re: wsevent cleanup
To: Martin Husemann <martin@duskware.de>
From: Julio M. Merino Vidal <jmmv84@gmail.com>
List: tech-kern
Date: 02/06/2006 13:31:00
El 06/02/2006, a las 12:30, Martin Husemann escribi=F3:
> On Mon, Feb 06, 2006 at 12:21:58PM +0100, Julio M. Merino Vidal wrote:
>> - Add two new functions, wsevent_free and wsevent_inject. The former
>> returns the amount of free space in the queue and the latter adds a
>> new event to it. The latter assumes that the queue has at least =20=
>> one
>> free slot.
>
> I think wseevent_free is a poor name (sonds like the free you do =20
> after malloc).
> Maybe wsevent_available()?
Excellent. I also thought that free was inappropriate but couldn't
think of a better name :-)
> Why can't you make wsevent_inject just fail if there is no space =20
> and have
> the caller deal with that?
That'd simplify the code even more and make it slightly faster because
checking for a single free slot is more lightweight than calling
wsevent_available.
I didn't do this because, some times, you want to inject more than one
event at once (strictly speaking, only the code I added yesterday has
this behavior... but am now thinking that the event processing code in
wsmouse could also use this to do everything atomically). In such case,
you'd be checking first if there is room for two elements and then, each
inject could redo the check to see if there is room for one element.
Hmm... does this make any sense?
Looks like making wsevent_inject fail if there is no space is closer to
what many other functions do in the system... then, I shall change it =20=
for
the sake of consistency.
Thanks for the comments!
--=20
Julio M. Merino Vidal <jmmv84@gmail.com>
The Julipedia - http://julipedia.blogspot.com/