Re: [gtk-win32] g_io_channel_win32_poll() and pipes....




I'm trying to debug a program (under Windows) that uses
g_io_channel_win32_poll().  However it seems to use that function with a
pipe.  Every example I've found on the internet seems to only show it
being used with sockets.  Is this function valid for a pipe or should I be
using something else - for example, 'g_poll()'?

Also, would someone be kind enough to remind me where I can find the
descriptions for these functions?

To answer my own questions....  I've read some of the comments in
glib-2.0/glib/giochannel.h and I've realised that the above function can
(apparently) be used with pipes but not interchangeably (in other words, I
cannot use read() or write() etc. I should use, g_io_channel_read() and the
associated functions).  I gather that the sequence of operations goes
something like this:-

1) Create a GIOChannel using g_io_channel_win32_new_fd(gint fd)

2) Use the above to make a GPollFD using g_io_channel_win32_make_pollfd()

3) Now carry out polling using g_io_channel_win32_poll()

However I'm confused about what the 'fd' parameter should be in that first
call to g_io_channel_win32_new_fd(gint fd).  I tried passing the value
returned from calling Windows '_pipe()'  - but g_io_channel_win32_new_fd()
returned a NULL pointer for my GIOChannel (i.e. the call failed).  So what
am I supposed to pass to it?

Also, it'd still be great if I could find some decent documentation for
this.

Thanks,

John

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