[Xcb] [PATCH v2] Support xcb_discard_reply (was Do not block when calling reply() multiple times)

Peter Harris pharris at opentext.com
Fri Feb 5 09:07:30 PST 2010

On 2010-02-04 21:42, Eamon Walsh wrote:
> Peter Harris wrote:
>> Ah, good point. No, it does not work with _unchecked() calls. I didn't
>> test that because reply-expecting calls have the 'checked' flag by default.
>> Is discarding _unchecked replies important? If so, I can fix it. If not,
>> I can document it.
> The use case that motivated this thread is that in xpyb, XCB cookies are
> represented by objects, and when a cookie object gets garbage collected,
> we want to make sure that the associated reply (or replies) have been
> cleaned up.  It would be great if I could just blindly call a function
> from the cookie destructor to do this, regardless of what the request is
> or what the user has done so far.  So I'd say that ideally yes, it
> should work for _unchecked calls.

Okay. Fixed in the attached patch.

It should even be safe to call xcb_discard_reply multiple times for the
same sequence number (modulo bugs, of course).

>> My current beef with the patch is that it requires horrible typecast
>> gymnastics to convert a specific cookie type to an xcb_void_cookie_t.
> In response to the discussion of the cookie sequence number being
> "opaque," in a strict C language sense this is not true.  The sequence
> field is visible in the public API.  Within xpyb, xcb_wait_for_reply()
> is being used at present.  So, I'd say it would be fine to use the
> sequence directly in another API call.

That seems to be the consensus, so that's what I've done for this
version of the patch.

Peter Harris
               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
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-Support-xcb_discard_reply.patch
Url: http://lists.freedesktop.org/archives/xcb/attachments/20100205/a32647a6/attachment.ksh 

More information about the Xcb mailing list