[Xcb] Threading Application Question

Cinolt cinolt.yk at gmail.com
Mon Nov 7 16:57:14 PST 2011

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

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

Here is the 60-line commented example, it is quite self-explanatory:

Thanks for any help.

More information about the Xcb mailing list