bert@let.rug.nl (Bert Bos) (01/10/91)
I'm writing a program using X Windows that also needs to read input coming in over a pipe. The incoming data is displayed in a window, but while that happens, the program has to check for events (expose, button press, etc.) My current solution is to simply poll both sources of input (using non-blocking read and XPending) but this seems rather wasteful of processor time. Is there a way to wait for something to arrive on either channel? Would such a solution indeed be more efficient? (I'm using X11R3, no widgets, and HP-UX; programming is done in C) Please e-mail. -- "Always remember, however, that there's Bert Bos (bert@let.rug.nl) usually a simpler and better way to do Alfa-informatica something than the first way that pops RijksUniversiteit Groningen into your head." (D.E. Knuth, TeXbook) Groningen, The Netherlands
spot@CS.CMU.EDU (Scott Draves) (01/11/91)
In article <1487@gufalet.let.rug.nl> bert@let.rug.nl (Bert Bos) writes:
I'm writing a program using X Windows that also needs to read input
coming in over a pipe. The incoming data is displayed in a window, but
while that happens, the program has to check for events (expose,
button press, etc.)
Get the file descriptor Xlib is using with ConnectionNumber, and then
do a select on that and your pipe. If you are using Xt, then you
should use XtAppAddInput().
--
IBM
Scott Draves Intel
spot@cs.cmu.edu Microsoft