[Xcb] POSIX threads cancellation / VLC

Barton C Massey bart at cs.pdx.edu
Mon Dec 14 23:28:49 PST 2009


You wrote:
> 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.

Wow!  Cool!

> Anyway. VLC uses *synchronous* thread cancellation in many code paths, and
> our XCB event handling looks like:
> 
> for (;;)
> {
>     poll(xcb_fd);
>     disable_cancel();
>     handle_xcb_events...;
>     enable_cancel();
> }
> 
> 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.

Hmmm.  I don't know if I have a strong opinion on this.  On
the one hand it would muck up the code some, but on the
other hand other folks might want it also, in which case it
would be worth it.

Let's see what the rest of the list thinks?

Thanks much for the note.

    Bart


More information about the Xcb mailing list