[Xcb] Why is an explicit xcb_flush needed?

Josh Triplett josh at joshtriplett.org
Tue Mar 30 00:22:04 PDT 2010


On Tue, Mar 30, 2010 at 08:14:54AM +0200, Nicholas Allen wrote:
> Hi,
> 
> I'm just curious as to why adding xcb_flush prior to xcb_wait_for_event
> fixes most of my deadlocking issues. I would have thought that XCB would
> flush automatically if it needs a reply for synchronous usage.
> 
> To me it seems like a bug in XCB that I need to explicitly call
> xcb_flush before xcb_wait_for_reply but maybe I just don't understand
> the design of XCB well enough. Sorry if this is a silly question but I
> would like to start understanding what's causing my problems in order to
> fix it...

You don't need to call xcb_flush prior to xcb_wait_for_reply;
xcb_wait_for_reply will flush if you try to wait on a reply for a
request that XCB hasn't sent yet.

You need to call xcb_flush prior to xcb_wait_for_event, if and only if
you expect an event that will only occur after XCB sends a particular
request, and you haven't done anything else to guarantee the flush of
that request.

Does that make sense?

- Josh Triplett


More information about the Xcb mailing list