Xlib: unexpected async reply (sequence 0x7)

Glynn Clements glynn at gclements.plus.com
Thu Nov 15 15:26:11 PST 2007

Matthias Käppler wrote:

> BUT, to get back on topic: As to the "unexpected async reply" errors. With
> the risk of ridiculing myself, I "fixed" the problem by simply opening the
> same display again using XOpenDisplay(NULL) in the event thread. Using the
> Display pointer returned by that call (which is then specific to that
> thread), I no more receive these errors.
> I guess this however is not the way it is intended to use? I mean, I call
> the same function with the same argument (XOpenDisplay(NULL)) in both
> threads now, and use the respective Display structure instances only within
> the boundaries of their "parent" threads. While this does the job, will this
> have any other side effects?

No. So long as the two instances are completely isolated from each
other, there isn't a problem. You could just as well call
XOpenDisplay() on a completely different display.

So far as the X server is concerned, it's dealing with two completely
different clients (it probably won't even "know" that they're the same
process). E.g. if one "client" requests notification of a particular
event type with XSelectInput(), it will report events to that client. 
If the other client wants notification, it will have to request it

You can still communicate some X-related information between the two,
but only to the extent that it can normally be communicated between
distinct clients. E.g. XIDs are global to a display (X server), so
there's no problem in communicating those. OTOH, any client-side data
which has a display-specific component will need to be used with the
correct Display*.

Glynn Clements <glynn at gclements.plus.com>

More information about the xorg mailing list