[Xcb] How to wake up the GUI thread in XCB?

Peter Harris pharris at opentext.com
Wed May 20 09:49:50 PDT 2015


On 2015-05-19 18:09, Cosmin Apreutesei wrote:
> I have another question, this time I'm not sure I can get away without
> threads. I would need something like xcb_wait_for_event(timeout). It
> would make implementing timers trivial. But I guess
> xcb_wait_for_event() doesn't use select() internally on a NULL
> connection, so it's not as simple as just exposing the timeout arg
> from that, right? Is that why I don't find an API for that, or is it
> more complicated than that?

Generally if you want anything fancy (selecting on multiple file
descriptors, custom timeout, etc) you would
xcb_poll_for_queued_event()[1] until it returns NULL, then
xcb_get_file_descriptor() and do your own select/poll/epoll/etc.

Peter Harris

[1] xcb_poll_for_queued_event() is relatively recent; you may need to
use xcb_poll_for_event() if your libxcb is a little bit older.
-- 
               Open Text Connectivity Solutions Group
Peter Harris                    http://connectivity.opentext.com/
Research and Development        Phone: +1 905 762 6001
pharris at opentext.com            Toll Free: 1 877 359 4866


More information about the Xcb mailing list