<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jul 12, 2015 at 12:32 PM, Josh Triplett <span dir="ltr"><<a href="mailto:josh@joshtriplett.org" target="_blank">josh@joshtriplett.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">On Sun, Jul 12, 2015 at 05:27:38PM +0000, Bart Massey wrote:<br>
> xcb_get_file_descriptor() does what you think it does. The description in<br>
> the documentation is based on the fact that xcb_connect_to_fd() is always<br>
> called to open a connection: the "you" is a bit confusing there and should<br>
> probably be fixed.<br><br></span></blockquote><div>ok so fine for my use, we just need to fix the docs. If you have a pointer to the source, I will write a diff. </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">
> Josh's email is mostly talking about selecting on replies rather than<br>
> events.<br>
<br>
</span>I was talking about either replies or events; in either case, it's<br>
possible for XCB to have already read them off the wire and buffered<br>
them, so the fd no longer has data, but you shouldn't block.<br>
<span class=""><br>
> X mixes replies and events on a single TCP stream, and XCB demuxes and<br>
> queues them. You don't really have access to the event queue like in Xlib<br>
> because that is error-prone and expensive. You will have to be kind of<br>
> careful with the selects and use the non-blocking event grabber<br>
> xcb_poll_for_event() to get this to work. It will be fiddly to get right,<br>
> but as far as I can remember it should work. If you are careful, the only<br>
> time XCB should block is waiting for a server response when you force a<br>
> cookie early. XCB doesn't really care if you block in your own code.<br>
><br>
> while true<br>
>     select on fd<br>
>     if fd is x connection<br>
>         while xcb_poll_for_event returns an event<br>
>             process the event<br>
>     else<br>
>         handle the fd however<br>
<br></span></blockquote><div>This indeed basically was my plan (select at the bottom of the loop instead of the top, but same idea)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">
</span>That *should* work, assuming no other thread touches XCB, and assuming<br>
you check for outstanding replies in addition to events whenever you<br>
have request cookies that you don't have the replies for yet.<br>
<span class=""><font color="#888888"><br>
- Josh Triplett<br>
</font></span></blockquote></div><br>Single threaded no no worries about another thread, but if xcb_poll_for_event does not check for replies what is the non-blocking way to check for replies? or do I just check if an event is a reply event?<br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div>--</div><div><div>Ben Hildred</div><div>Automation Support Services</div></div><div>303 815 6721</div></div>
</div></div>