[Xcb] [PATCH v2 libxcb] Prevent reply waiters from being blocked.

jamey at minilop.net jamey at minilop.net
Tue Oct 12 10:46:08 PDT 2010


I don't understand Josh's objections to this patch.

1) XCB_SEQUENCE_COMPARE_32 handles sequence-number wrap; we do
inequality tests with it elsewhere, and they'd better work too.

2) Even multi-reply requests are obviously not going to get any
further responses once we've seen a higher sequence number. The
earlier waiters will check against c->in.request_completed, and will
not block once awakened. So waking up those threads is correct.

In hindsight, your analysis and patch both look obviously correct to
me. This might explain Havoc's xcb_request_check bug (#29599) in
addition to maybe helping with the Xlib threading bugs.

As far as I can tell, your patch can be simplified to just
unconditionally call pthread_cond_signal in the loop. I'm happy to
accept a patch doing just that if you can confirm it fixes this bug.

I think it's possible to avoid quite a bit of work in the
response-reading path by being a little more clever here, and I
started trying to code up the patches I had in mind, but we should
just merge your fix before trying to be clever.

Jamey


More information about the Xcb mailing list