[Xcb] [PATCH 2/3] Do not block when calling reply() multiple times.

Peter Harris pharris at opentext.com
Tue Feb 2 12:50:14 PST 2010


On 2010-02-01 20:44, Jamey Sharp wrote:
> On Tuesday, February 2, 2010, Peter Harris <pharris at opentext.com> wrote:
>> This feels like duplication of effort to me. XCB already keeps a queue
>> of requests that have been issued. It already tracks which replies it
>> should discard (ignore) in the future, too.
>>
>> Therefore, what do you think of the attached? It adds
>> xcb_discard_reply(), which does free(wait_for_reply(cookie, NULL))
>> except it doesn't block when the reply hasn't been received yet.
> 
> I can't review the patch properly at the moment, but it looks
> promising. Does it correctly handle discarding the multiple replies of
> a ListFontsWithInfo or similar?

Yes. It even works if you xcb_list_fonts_with_info_reply a couple of
times, decide you have found the font you're interested in, and
xcb_discard_reply() the rest with a single function call.

> Does it work if the request didn't
> originally queue a request record, as happens when there are no flags
> or workarounds?

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.

> Assuming the patch is correct, I'd take it.

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.
I'm not sure if that can be fixed without either breaking existing apps
or adding a gazillion request-specific discard functions.

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


More information about the Xcb mailing list