Asynchronous input from several sources: how?

Bert Bos bert at let.rug.nl
Fri Jan 11 02:39:27 AEST 1991


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 at 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



More information about the Comp.unix.programmer mailing list