libX11: Changes to 'xlib-xcb-thread-fixes'
Jamey Sharp
jamey at kemper.freedesktop.org
Sun Apr 18 01:41:46 PDT 2010
New branch 'xlib-xcb-thread-fixes' available with the following commits:
commit 933aee1d5c53b0cc7d608011a29188b594c8d70b
Author: Jamey Sharp <jamey at minilop.net>
Date: Fri Apr 16 20:18:28 2010 -0700
Fix Xlib/XCB for multi-threaded applications (with caveats).
Rather than trying to group all response processing in one monolithic
process_responses function, let _XEventsQueued, _XReadEvents, and
_XReply each do their own thing with a minimum of code that can all be
reasoned about independently.
Tested with `ico -threads 20`, which seems to be able to make many
icosahedrons dance at once quite nicely now.
Caveats:
- Anything that was not thread-safe in Xlib before XCB probably still
isn't. XListFontsWithInfo, for instance.
- If one thread is waiting for events and another thread tries to read a
reply, both will hang until an event arrives. Previously, if this
happened it might work sometimes, but otherwise would trigger either
an assertion failure or a permanent hang.
- Versions of libxcb up to and including 1.6 have a bug that can cause
xcb_wait_for_event or xcb_wait_for_reply to hang if they run
concurrently with xcb_writev or other writers. So you'll want that fix
as well.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Reviewed-by: Josh Triplett <josh at freedesktop.org>
commit aab43278ae619eb57d2dd9c7396f460f078588fc
Author: Jamey Sharp <jamey at minilop.net>
Date: Fri Apr 16 22:24:16 2010 -0700
Use InternalLockDisplay on code paths called from LockDisplay.
It's easier to reason about the code when we can't re-enter the
Xlib-private sync-handlers while they're already running.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Reviewed-by: Josh Triplett <josh at freedesktop.org>
commit 660b7d05f4ca4ab4661c9fe7ce655a4909b4e556
Author: Jamey Sharp <jamey at minilop.net>
Date: Fri Apr 16 19:45:11 2010 -0700
Fix _XSend to enqueue the right range of pending requests.
_XSend was off-by-one on both ends. It should not re-enqueue the last
request that was already flushed, but it should enqueue the last request
currently being flushed.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Reviewed-by: Josh Triplett <josh at freedesktop.org>
commit f2735889908d6e5a7f8dbee42f00c54a52665191
Author: Jamey Sharp <jamey at minilop.net>
Date: Fri Apr 16 19:45:11 2010 -0700
Pending requests are always added in-order.
Replace insert_pending_request, which did an in-order search of the
queue to find the right insertion point, with a simpler
append_pending_request, and use that in _XSend as well.
Includes assertions to check that the list of pending requests is in
order by sequence number and does not have duplicates.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Reviewed-by: Josh Triplett <josh at freedesktop.org>
More information about the xorg-commit
mailing list