Question on interprocess communication and signals

Leslie Mikesell les at chinet.chi.il.us
Fri Aug 31 00:44:15 AEST 1990


In article <265 at jabberwock.shs.ohio-state.edu> reiner at jabberwock.shs.ohio-state.edu (Reiner Wilhelms) writes:

>Question 2: 
>How can one build a communication line between the two such that A
>dials B, and says: "Hey, I have a new data set for you!" Essentially
>program A "presses the read-new-data button" of program B.  What would
>the notification routine look like, and what kind of signals could I
>use to establish the cooperation of the two programs?

You probably have select() which can block while waiting for any of
several inputs, but since I'm stuck with SysV for the moment, my
favorite technique is to funnel all inputs through a single pipe
(or FIFO where it is inconvienent to make all processes have a common
parent).  In your case, the screen-drawing program might read all
its commands from a pipe fed by both the keyboard-reading process
and the data-generating process.  There are some tricks to make it
work, though.  The commands must either be of a fixed length or
contain a length field so that the reader can seperate them at
the original boundaries, and the complete command must be written
in a single write() and must be less than PIPE_MAX in size to
avoid interleaving with data from a different process.

Les Mikesell
  les at chinet.chi.il.us 



More information about the Comp.unix.questions mailing list