diff options
author | Jamey Sharp <jamey@minilop.net> | 2010-04-16 20:18:28 -0700 |
---|---|---|
committer | Jamey Sharp <jamey@minilop.net> | 2010-04-18 01:28:38 -0700 |
commit | 933aee1d5c53b0cc7d608011a29188b594c8d70b (patch) | |
tree | 2ac0431b4b79b909c8e0564a0b8d134f0d44c325 /src/XlibInt.c | |
parent | aab43278ae619eb57d2dd9c7396f460f078588fc (diff) | |
download | xorg-lib-libX11-933aee1d5c53b0cc7d608011a29188b594c8d70b.tar.gz |
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@minilop.net>
Reviewed-by: Josh Triplett <josh@freedesktop.org>
Diffstat (limited to 'src/XlibInt.c')
0 files changed, 0 insertions, 0 deletions