Re: gtk_input_add (posted earlier with wrong subject)



Hi there,

I have tried to ways to use input_add.
1. Open a file for read and send in the filehandle to input_add.
   Here i never gets any calls to my function at all.
2. open a file and use fileno( filehandle ) as an input to input_add.
   Here the callback gets called all the time without any new data in
the file to read.
Anybody who understand how to use input_add on a ordinary filhandle?
Please give me an short example.

I've used input_add to 1) read from a pipe that is 'tail -f <somefile>' and 2)
read from an IO::Socket::INET. In both cases, the filehandle that input_add
listens to has something new to read at different points in time, that is, if
that handle is in an IO::Select, it becomes ready to read from. I'm not sure
that such a state change is occurring in the file handles your input_add is
watching.

Let's assume for a moment that there is such a change, then I believe
input_add is using a select() somewhere in its implementation, so you can't
use the angle operators <>, you have to use sysread() in your input handler to
read from the file handle. I've run into the kinds of error conditions you
described when using <> on handles which are already in select().

-bhaskar




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