The X Toolkit does not call the callback function registered with XtAppAddInput when there is some input pending on the registered file descriptor, unless an X event has recently been processed. This can easily been reproduced with the attached test program. The program consists of three threads: - main thread: initialization, makes a pipe, registers the pipe[0] fd as additional input, creates two other threads and runs the X Toolkit main loop (XtAppNextEvent and XtDispatchEvent). - WorkThread: endless loop, which calls XQueryTree and then sleeps for three seconds. - SignalWaiterThread: handles SIGINT signal using sigwait(), and writes to pipe[1] when a signal has arrived. When SIGINT is catched, the input callback for pipe[0] should be called, but most of the time, it is not. You can enforce the callback to be called by generating an X event, e.g. by using the command "xmodmap -e 'pointer = default'".
Created attachment 428 [details] mttest test program (gzipped tar file) How to use the test program: Compile the attached mttest.c program using the Imakefile. Run it with "./mttest". Press the INTR character several times. Observe that the signal handler is called, but the additional input is not recognized. The output is: pascal:/(162)> ./mttest pipe 4 Work is active ... ./mttest: [signal waiter]: signal 2 ./mttest: [signal waiter]: signal 2 ./mttest: [signal waiter]: signal 2 ./mttest: [signal waiter]: signal 2 ... Whereas it should be: pascal:/(162)> ./mttest pipe 4 Work is active ... ./mttest: [signal waiter]: signal 2 ReadControlConnectionCB ./mttest: received SIGN 2 ./mttest: [signal waiter]: signal 2 ReadControlConnectionCB ./mttest: received SIGN 2 ./mttest: [signal waiter]: signal 2 ReadControlConnectionCB ./mttest: received SIGN 2 ...
Created attachment 429 [details] [review] context diff to lib/Xt/NextEvent.c, either workaround of fix With this patch applied to NextEvent.c, the bug seems to not occur. Might have a small performance penalty, because the fdlist is now rebuild more often. On the other hand, I think this might be required, because select() modifies the fd_sets ...
Comment on attachment 429 [details] [review] context diff to lib/Xt/NextEvent.c, either workaround of fix alan/egbert: Do you know anyone who is able to review the patch ?
Ping!
Sorry about the phenomenal bug spam, guys. Adding xorg-team@ to the QA contact so bugs don't get lost in future.
committed, not quite three years later. thanks for the patch!
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.