From 55790836fb5304356da4e0de63c5335bef1656db Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Sun, 20 Jul 2008 20:44:39 +0000 Subject: [PATCH] Patch from Yu Kuan that makes watched sockets behave much better. See 2008-07-20 Tor Lillqvist * glib/giowin32.c (g_io_win32_prepare): Patch from Yu Kuan that makes watched sockets behave much better. See gtk-devel-list archives from May for the (unfortunately rather meager) discussion. This patch fixes the presented simple test program, which reasonably could be expected to work. svn path=/trunk/; revision=7220 --- ChangeLog | 8 ++++++++ glib/giowin32.c | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index e843463..8e2c3bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-07-20 Tor Lillqvist + + * glib/giowin32.c (g_io_win32_prepare): Patch from Yu Kuan that + makes watched sockets behave much better. See gtk-devel-list + archives from May for the (unfortunately rather meager) + discussion. This patch fixes the presented simple test program, + which reasonably could be expected to work. + 2008-07-18 Matthias Clasen * NEWS: Updates diff --git a/glib/giowin32.c b/glib/giowin32.c index eef439b..1f6727f 100644 --- a/glib/giowin32.c +++ b/glib/giowin32.c @@ -733,6 +733,13 @@ g_io_win32_prepare (GSource *source, if (channel->debug) g_print ("\n setting last_events=0"); channel->last_events = 0; + + if ((event_mask & FD_WRITE) && !channel->write_would_have_blocked) + { + if (channel->debug) + g_print (" WSASetEvent(%#x)", watch->pollfd.fd); + WSASetEvent ((WSAEVENT) watch->pollfd.fd); + } } break; -- 2.7.4