[Xcb] Threading Application Question

Josh Triplett josh at joshtriplett.org
Mon Nov 7 17:28:40 PST 2011


On Mon, Nov 07, 2011 at 07:57:14PM -0500, Cinolt wrote:
> Hello all, I'm developing an XCB application. I have chosen to use a
> text-FIFO-based (echo >$FIFO cmd) method for part of user interaction.
> The application is to wait for events using the blocking
> xcb_wait_for_event function. To read from the FIFO I would need to
> have a separate thread, that reads from it and also calls XCB
> functions accordingly, while the main thread concurrently handles
> events.
> 
> My question is how safe is it to do this? In my extremely simple
> example I have provided below it seems to work fine, but in my
> application where it will be more complex (the second thread will call
> more XCB functions and the main thread's event handling will be more
> convoluted) is there a chance it might slip up somewhere without
> proper synchronizing functions, or is XCB designed to prevent this
> automatically?

XCB should handle the case you want automatically.  If it does not,
please report a bug. :)

- Josh Triplett


More information about the Xcb mailing list