[Xcb] POSIX threads cancellation / VLC
remi at remlab.net
Mon Dec 14 22:54:13 PST 2009
I am happy to announce that VLC media player (what will become vesion
1.1.0) has been almost completely ported to XCB. Namely, the X11 and XVideo
outputs, the screen capture input, the (new) screen capture wizard, the
windowing code, the "global hotkeys", and the seldom used panaromic video
filter are now purely XCB-based. Also, the GLX output was rewritten to
X11-XCB. This just leave the Qt4 UI, the VAAPI bindings to libavcodec, and
the skin engine using Xlib.
The main driver for XCB was saner error/event handling and thread safety.
It was practically impossible to use Xlib properly with the multi-thread
and plugin-based architecture that VLC has. Also, this was a good
opportunity to rebuild our X11 competence and refactor the aging code.
Anyway. VLC uses *synchronous* thread cancellation in many code paths, and
our XCB event handling looks like:
This is not terribly efficient. We could use XCB in blocking mode, but we
need to catch the cancel signal from a safe place. So I'm wondering if
handling thread cancellation directly inside XCB would be acceptable.
Mostly, this means installing cleanup handlers in strategic places, and
disabling cancellation in some other ones in the core XCB code.
I had a partial patch for this, but I wouldn't bother rebasing it you guys
don't like the idea at all.
More information about the Xcb