non-blocking file access



Hi.

I need to watch several files (pipes) and read information from them
in a GUI program.  My main target platform is GNU/Linux, but I'd prefer
to do it as platform-independent as possible (probably hiding platform-
dependent functions in GLib).  GLib provides a way to portably create
processes and pipes to them, so this part is solvable nicely.

The next part is performing non-blocking and efficient reading from
the pipes.  As I have understood, GLib provides a way to watch file
descriptors for new data with custom event sources.  However, I was
unable to determine if it is possible to read all available data from a
pipe with GLib (or with ANSI C file/stream access functions).

So, can anyone point me to a way of implementing this efficiently and
using as few platform-specific functions as possible?  GLib + ANSI C
functions are preferable, any other portable functions are the next to
best choice.  If you can give me just basic ideas, that's fine, I'm sure
I can do without sample code :)

I'd also like to know if a write operation to a pipe can block.

Thanks in advance.

Paul



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