[AD] X11 unresponsiveness

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


[Resent, sorry if it appears double now]
The attached patch makes all X11 programs (even expal, or the demo with
page flipping) completely responsive. And in the demo, I see no change
in FPS compared to before. The problem is, it removes a line which I
have no idea what its purpose was.

Peter, can you comment on it?

There's a call to XLOCK protecting the input code, so there is no
problem with thread safety after removing that if. My guess is, the
removed line should maybe prohibit re-entrancy of the event handler
itself, so a lot of input wouldn't cause lots of XLOCKs. If that's true,
and it makes sense, we could add code for that again, but it should only
block on the function itself then, not on all XLOCKs. I'm not sure at 
all though that's what it was for though.

After reading http://tronche.com/gui/x/xlib/display/XLockDisplay.html,
what I think is happening with the line removed (but not really sure):
XLOCK waits, until whatever X11 calls holds the lock, is done, then goes
into the input code and fetches up to 5 events.

What happened previously, with that line: As long as any other X11 calls
were active, all input was blocked. In the case of expal or the demo
game with page flipping, the screen is updated as fast as possible,
therefore X11 is always locked in X11 palette/drawing operations, and
input was never handled (or with increasing and increasing delay).

I'll be testing all the examples and some other programs - and if I see
no problems or someone here can point to possible problems, I'll commit
it to 4.0.x and 4.1.x.

-- 
Elias Pschernig
Index: src/x/xwin.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/x/xwin.c,v
retrieving revision 1.61
diff -u -p -r1.61 xwin.c
--- src/x/xwin.c	11 Jul 2004 10:33:10 -0000	1.61
+++ src/x/xwin.c	12 Jul 2004 12:39:47 -0000
@@ -2434,8 +2434,6 @@ static void _xwin_private_handle_input(v
 
 void _xwin_handle_input(void)
 {
-   if (_xwin.lock_count) return;
-
    XLOCK();
 
    if (_xwin_input_handler)


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