[PATCH] Fix XNextRequest() after direct usage of XCB

Jamey Sharp jamey at minilop.net
Mon May 12 18:32:51 PDT 2014

On Sat, May 10, 2014 at 02:55:11PM +0200, Uli Schlachter wrote:
> On 10.05.2014 00:21, otaylor at redhat.com wrote:
> > From: "Owen W. Taylor" <otaylor at fishsoup.net>
> > 
> > When XCB owns the X socket, dpy->request is not updated, so
> > NextRequest() and XNextRequest() return the wrong value. There's
> > nothing we can do to fix NextRequest() while retaining ABI compat,
> > but change XNextRequest() to grab the socket back from XCB,
> > updating dpy->request.
> > 
> > Signed-off-by: Owen W. Taylor <otaylor at fishsoup.net>
> Reviewed-by: Uli Schlachter <psychon at znc.in>
> (And this also makes this function thread safe on 32bit archs were reading a
> 64bit value isn't atomic)

I don't have any issues with the patch, aside from possibly making
people think that using NextRequest is a good idea. :-)

But this comment isn't true; neither NextRequest nor XNextRequest can
ever be made thread-safe in any implementation, as you could always race
with another thread that's issuing a request, which invalidates
NextRequest's post-conditions.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20140512/71a86a0c/attachment.sig>

More information about the xorg-devel mailing list