g_io_channel_win32_new_fd



Hi everybody,

The section on IO Channels in the glib manual says the following about g_io_channel_win32_new_fd ():

If you have created a GIOChannel for a file descriptor and started
watching (polling) it, you shouldn't call read() on the file
descriptor. This is because adding polling for a file descriptor is
implemented in GLib on Windows by starting a thread that sits blocked
in a read() from the file descriptor most of the time. All reads from
the file descriptor should be done by this internal GLib thread. Your
code should call only g_io_channel_read().

Now I'd like to use g_io_channel_win32_new_fd on stdin with pygtk. In this case, reading from stdin is done in Python, which doesn't use g_io_channel_read internally. Hence, on Windows polling stdin using g_io_channel_win32_new_fd does not give me the desired behavior.
On unixes, using the corresponding g_io_channel_unix_new works fine.

So I was wondering if there is a fundamental reason why on Windows polling for a file descriptor needs to have its own thread. If not, might it be worth my time to look deeper into this?

--Michiel.



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