Xlib: unexpected async reply (sequence 0x7)

Glynn Clements glynn at gclements.plus.com
Thu Nov 15 08:00:03 PST 2007


Matthias Käppler wrote:

> > More generally, you would be much better off not using a separate
> > event loop. Why can't you have the main event loop notify your code of
> > FocusIn events?
> 
> 
> Well, the event loop is an endless loop and blocks on the XNextEvent() call.
> This actually blocks the whole JVM process because that native event loop is
> called from it and all Java threads run within the same Java system process.
> So, this would be unacceptable since our program would simply stop running.

You don't have to implement the event loop so that it blocks.

XNextEvent() will only block if there are no events in the queue and
none of the X descriptors are ready for reading. You can obtain any
descriptors used by X with XInternalConnectionNumbers(), then select()
or poll() those descriptors to determine when to process them.

-- 
Glynn Clements <glynn at gclements.plus.com>



More information about the xorg mailing list