gdk_input_add question



First off, thank you to those that answered my last question, it helped
immensely.

My next question:

I have two processes that talk to each other through pipes (create with
pipe, not named pipes).  My plan was to have one process get and compute
data from /dev/dsp and send the data to the process that would read in
the data and plot it to the screen using gtk (this works just fine).  I
though that I would use gdk_input_add () to monitor the read end of the
pipe, i.e. the  file descriptor.  I thought this would work well for
when the other process was not writing data, as in there would be no
data ready to be read by the process doing the plotting the 'callback'
would not be called.
<quote from GTK v1.2 Tutorial>
GDK_INPUT_READ - Call your function when there is data ready for reading
on your file descriptor.

This being the condition passed to:
gint gdk_input_add( gint              source,
                         GdkInputCondition condition,
                         GdkInputFunction  function,
                         gpointer          data );

Now this seems to work while there is data to read, but when the process
generating the data stops generating new data the GdkInputFunction
continues to be called.  This is not expectable for this application.
I have thought of using:
void gdk_input_remove( gint tag );
where tag is the return value of gdk_input_add ().  But for some reason
I think that the above call should work on its own.  After the process
that generates data stops writing to the pipe a read from the pipe
returns a byte count of zero, no data ready to be read, or?

Once again if I have not included enough information pleas let me know.

I appreciate your help
Mohrgan

I am told that there are no stupid questions, I hope you agree :-)




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]