Bug 29657 - missing main loop integration API
Summary: missing main loop integration API
Alias: None
Product: XCB
Classification: Unclassified
Component: Library (show other bugs)
Version: unspecified
Hardware: All All
: medium normal
Assignee: xcb mailing list dummy
QA Contact: xcb mailing list dummy
Depends on:
Reported: 2010-08-18 15:48 UTC by Havoc Pennington
Modified: 2019-02-16 19:41 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Description Havoc Pennington 2010-08-18 15:48:00 UTC
To use XCB nicely with a main loop instead of threads, I think the following are missing.

1. a way to see if any events or replies are buffered (like XPending, but no IO). Used in the "prepare" and "check" steps of GLib main loop for example. Ideally, separate xcb_has_events and xcb_has_replies perhaps. Errors are events if treated as events and replies if checked.

2. a way to "read from socket into internal queue without returning any events or replies". Used in GLib "check" step for example, followed by the XPending type thing.

3. a way to "partially flush with a single write() call" - xcb_partial_flush?

Then in something like GTK, you would have:

* a GSource for the event queue, similar to current Xlib one. Uses current 
xcb_poll_for_event in dispatch(), but uses the new API for prepare and check.
Can also poll on writability and do the "xcb_partial_flush" if socket is writeable, so we never get requests that remain unsent if the main loop runs.

* a GSource that lets you add a callback to invoke when a specific reply arrives. This would need to do "read() just once from socket" in its check(), and then xcb_poll_for_reply

Right now the source that nonblockingly auto-flushes in main loop is not possible, and the source that does a callback when a specific reply arrives I don't think is possible either. (without threads, that is.)
Comment 1 GitLab Migration User 2019-02-16 19:41:30 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/lib/libxcb/issues/27.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.