gdk_input_add, poll() and select()




I've recently discovered that there is a difference between
the way gdk_input_add() behaves on systems emulating
poll() with select() and those with a native poll() call.

On the former systems, closing the other end of 
pipe causes a GDK_INPUT_READ, on the latter,
a GDK_INPUT_EXCEPTION.

This basically comes from the way GDK translates from
the poll-like flags of g_io_add_watch() into the 
select-like flags of gdk_input_add(); currently
it is:

 GDK_INPUT_READ <=> G_IO_IN | G_IO_PRI
 GDK_INPUT_WRITE <=> G_IO_OUT
 GDK_INPUT_EXCEPTION <=> G_IO_ERR | G_IO_HUP | G_IO_NVAL

Looking at the way the 2.2 Linux kernel sources do the
same translation, I think it I should have made this:

 GDK_INPUT_READ <=> G_IO_IN | G_IO_HUP | G_IO_ERR
 GDK_INPUT_WRITE <=> G_IO_OUT | G_IO_ERR
 GDK_INPUT_EXCEPTION <=> G_IO_PRI | G_IO_NVAL

(Actually, it isn't clear what to do with G_IO_NVAL ...
 since select() never generates an equivalent)

Unless somebody has a better suggestion, I'm just going
to go ahead and make this change for 1.2.1. There is a small
chance that it would break a program that was
functioning correctly on a system with native
poll(), but such a program wouldn't function correctly
either on older versions of GTK+ or on systems without
native poll()

Regards,
                                        Owen



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