Win32 GLib hackers: please try new socket GIOChannel/watch code



Please try the new giowin32.c attached to
http://bugzilla.gnome.org/show_bug.cgi?id=147392 . 

It no longer uses a separate thread for socket channels. (Thus getting
rid of much complexity, yay!) Instead, the WSAEventSelect() and
WSAEnumNetworkEvents() API is used. I associate a Windows event with a
socket, and poll the event handle. When the event fires the
corresponding network events are determined and the watch's revents
field is set accordingly.

I have used this API earlier this year in D-BUS and ORBit2, with good
results. Now when I was porting libsoup, I once again bumped into the
limitations of the old giowin32.c code. libsoup uses GIOChannels and
watches in a way that just didn't work at all with the old giowin32.c
code. So I converted giowin32.c to use the WSAEventSelect()
approach. At least for libsoup it helped marvellously.

(For C library file descriptors, the code still uses separate reader
threads. But fortunately, real applications and libraries that use the
GIOChannel and GSource machinery typically use it for sockets, not
file descriptors. GIMP's plug-in communication through pipes is an
exception.)

--tml




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