[Xcb] problem with xcb_poll_for_reply (or xcb_wait_for_reply)

Julien Danjou julien at danjou.info
Wed Aug 6 03:02:24 PDT 2008


At 1218009864 time_t, Barton C Massey wrote:
> I haven't dug around inside this code for a while, but I
> it's hard to use select() followed by poll_for_reply() in
> general.  Whenever XCB gets a chance, it likes to pull
> replies off the wire in big chunks and stick them in its
> internal queues.

Well, I can confirme this behaviour which is very annoying.

My current hack is to do something like:

select()
[…]
while((ev = xcb_poll_for_event(globalconf.connection)))
  xev_restart:
    xcb_handle_event(globalconf.evenths, ev);

/* do some other stuff */

 xcb_aux_sync(globalconf.connection);
 /* synchronize can wake up X and pull new events in the queue */
 if((ev = xcb_poll_for_event(globalconf.connection)))
     goto xev_restart;

But I think in theory select() can miss events since there's a race.
In practise it works quite well.

Cheers,
-- 
Julien Danjou
// ᐰ <julien at danjou.info>   http://julien.danjou.info
// 9A0D 5FD9 EB42 22F6 8974  C95C A462 B51E C2FE E5CD
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/xcb/attachments/20080806/ef06ac8d/attachment.pgp 


More information about the Xcb mailing list