Re: [AD] minor fix

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Elias Pschernig wrote:

poll_joy() should read all events

[...]

I'm personally undecided on wether this is a good thing or not. Any thoughts?

Well, Eric said this:

http://www.allegro.cc/forums/view_thread.php?_id=354745&;
I suppose this is patch #943753 on SF's tracker.  I've attached it.

Peter, do you have an opinion on the patch? I remember that you > didn't like a patch that would have made the same change (read all events) to the > Xlib event loop.

So I guess, nobody really knows how bad it is.

I don't think the linux joystick case has much relation to the X events case.

I problem I have with the patch was raised by Evert: it can cause you to lose events. Whether to apply the patch or not depends on how often you expect the joystick to be under-polled. If it's not very often, I'd rather do it as it is currently done and not lose any events.

while (read(joy_fd[i], &e, sizeof(struct js_event)) == sizeof(struct js_event))

The above means, if the joystick sends too much data - it will just hang
the Allegro program. OTOH, if the program is too slow to receive all
joystick input - there's a problem anyway. I don't have a joystick
myself to test it, and at least someone finds the new behavior better -
so I'd vote for applying it, and then see if linux programs start
behaving bad with joystick enabled.

I doubt you have to worry about that. Amongst other reasons, joysticks don't generate that much data. There is a context switch on every call to read() though -- you might want to try asking for more than one event at a time.

Peter




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/