[gnet-dev] Re: Glib win32 iochannels update



Martyn,

I have discovered what the problem is, or at least the first problem. There is an issue with the way the socket threads in glib on win32 are synchronized when you add a second watch to the iochannel.

Basically the code checks to see what conditions to look for, G_IO_IN etc across all watches and then does a select() call which goes to sleep on those conditions. It does not wake up until one of those conditions is met. This means that if you do a G_IO_IN, followed by a G_IO_OUT g_io_add_watch() call, the second will not happen until the first call happens on that socket.

The simple fix to this problem is to have a timeout on the select() call. When the timeout occurs do a continue; to restart the loop to reload the conditions to select() on. However, I do not know what a reasonable timeout should be. I am going to talk to David and investigate other options.

Andy



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