Do all timer stuff before blocking, avoiding a bunch of duplicate code and merge common code in WaitForSomething. The WaitForSomething changes need a bit of explanation to show that the new code is effectively equivalent to the old. Eliding error checking and trivial bits we've got: Before: if (ready clients) timeout = 0 else compute timeout i = poll if (i <= 0) { if (ready clients) return TRUE; if (input) return FALSE; if (any ready timers) { run timers return FALSE; } } else { if (input) return FALSE; if (any ready timers) { run timers return FALSE; } if (ready clients) return TRUE; } After: if (ready clients) timeout = 0; else compute timeout run_timers poll if (input) return FALSE; if (ready clients) return TRUE; The old code would return TRUE if there were ready clients and input pending. Dispatch would then schedule that ready client, but before processing any requests, it would notice that there was input pending and go process it. The new code just checks for input first, which is effectively the same. If the poll timed out and there weren't clients ready, then timers would get run. If the poll didn't time out, then timers would get run, even if there were clients now ready. Now, if the timeout interval was zero, that means that the timers must have been ready *before* poll was invoked. In this case, we should simply run the timers before calling poll -- no sense calling poll just to discard any data that it generates. If the timeout interval was non-zero, and poll didn't timeout, then either there aren't any timers to run, or we got a surprise and hit a timer exactly as a client became ready to run. This is the one case where the new code is different from the old; the new code delays the timer call until the next time WaitForSomething is called. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com> |
||
---|---|---|
Xext | ||
Xi | ||
composite | ||
config | ||
damageext | ||
dbe | ||
dix | ||
doc | ||
dri3 | ||
exa | ||
fb | ||
glamor | ||
glx | ||
hw | ||
include | ||
m4 | ||
man | ||
mi | ||
miext | ||
os | ||
present | ||
pseudoramiX | ||
randr | ||
record | ||
render | ||
test | ||
xfixes | ||
xkb | ||
.dir-locals.el | ||
.gitignore | ||
COPYING | ||
Makefile.am | ||
README | ||
autogen.sh | ||
configure.ac | ||
devbook.am | ||
docbook.am | ||
fix-miregion | ||
fix-miregion-private | ||
fix-patch-whitespace | ||
fix-region | ||
manpages.am | ||
xorg-server.m4 | ||
xorg-server.pc.in | ||
xserver.ent.in |
X Server The X server accepts requests from client applications to create windows, which are (normally rectangular) "virtual screens" that the client program can draw into. Windows are then composed on the actual screen by the X server (or by a separate composite manager) as directed by the window manager, which usually communicates with the user via graphical controls such as buttons and draggable titlebars and borders. For a comprehensive overview of X Server and X Window System, consult the following article: http://en.wikipedia.org/wiki/X_server All questions regarding this software should be directed at the Xorg mailing list: http://lists.freedesktop.org/mailman/listinfo/xorg Please submit bug reports to the Xorg bugzilla: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg The master development code repository can be found at: git://anongit.freedesktop.org/git/xorg/xserver http://cgit.freedesktop.org/xorg/xserver For patch submission instructions, see: http://www.x.org/wiki/Development/Documentation/SubmittingPatches For more information on the git code manager, see: http://wiki.x.org/wiki/GitPage