From: Tor Lillqvist Date: Fri, 15 Mar 2002 23:01:55 +0000 (+0000) Subject: Some debugging output formatting changes. The following two changes fixes X-Git-Tag: GLIB_2_0_1~24 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2c8e0c8d4062a4a096da65cd0a05f368a9be95f2;p=platform%2Fupstream%2Fglib.git Some debugging output formatting changes. The following two changes fixes 2002-03-16 Tor Lillqvist * glib/giowin32.c: Some debugging output formatting changes. The following two changes fixes a problem with buffered GIOChannels, noticed with the help of Owen's test program, thanks! (g_io_win32_prepare): Return value that takes the buffer condition into account, like g_io_unix_prepare() does. (g_io_win32_check): Ditto, like g_io_unix_check(). --- diff --git a/ChangeLog b/ChangeLog index d4db8f4..268fa9f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2002-03-16 Tor Lillqvist + + * glib/giowin32.c: Some debugging output formatting changes. The + following two changes fixes a problem with buffered GIOChannels, + noticed with the help of Owen's test program, thanks! + (g_io_win32_prepare): Return value that takes the buffer condition + into account, like g_io_unix_prepare() does. + (g_io_win32_check): Ditto, like g_io_unix_check(). + Thu Mar 14 17:37:45 2002 Owen Taylor * glib/giochannel.c (g_io_channel_write_chars): Fix some diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index d4db8f4..268fa9f 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,12 @@ +2002-03-16 Tor Lillqvist + + * glib/giowin32.c: Some debugging output formatting changes. The + following two changes fixes a problem with buffered GIOChannels, + noticed with the help of Owen's test program, thanks! + (g_io_win32_prepare): Return value that takes the buffer condition + into account, like g_io_unix_prepare() does. + (g_io_win32_check): Ditto, like g_io_unix_check(). + Thu Mar 14 17:37:45 2002 Owen Taylor * glib/giochannel.c (g_io_channel_write_chars): Fix some diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index d4db8f4..268fa9f 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,12 @@ +2002-03-16 Tor Lillqvist + + * glib/giowin32.c: Some debugging output formatting changes. The + following two changes fixes a problem with buffered GIOChannels, + noticed with the help of Owen's test program, thanks! + (g_io_win32_prepare): Return value that takes the buffer condition + into account, like g_io_unix_prepare() does. + (g_io_win32_check): Ditto, like g_io_unix_check(). + Thu Mar 14 17:37:45 2002 Owen Taylor * glib/giochannel.c (g_io_channel_write_chars): Fix some diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index d4db8f4..268fa9f 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,12 @@ +2002-03-16 Tor Lillqvist + + * glib/giowin32.c: Some debugging output formatting changes. The + following two changes fixes a problem with buffered GIOChannels, + noticed with the help of Owen's test program, thanks! + (g_io_win32_prepare): Return value that takes the buffer condition + into account, like g_io_unix_prepare() does. + (g_io_win32_check): Ditto, like g_io_unix_check(). + Thu Mar 14 17:37:45 2002 Owen Taylor * glib/giochannel.c (g_io_channel_write_chars): Fix some diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index d4db8f4..268fa9f 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,12 @@ +2002-03-16 Tor Lillqvist + + * glib/giowin32.c: Some debugging output formatting changes. The + following two changes fixes a problem with buffered GIOChannels, + noticed with the help of Owen's test program, thanks! + (g_io_win32_prepare): Return value that takes the buffer condition + into account, like g_io_unix_prepare() does. + (g_io_win32_check): Ditto, like g_io_unix_check(). + Thu Mar 14 17:37:45 2002 Owen Taylor * glib/giochannel.c (g_io_channel_write_chars): Fix some diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index d4db8f4..268fa9f 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,12 @@ +2002-03-16 Tor Lillqvist + + * glib/giowin32.c: Some debugging output formatting changes. The + following two changes fixes a problem with buffered GIOChannels, + noticed with the help of Owen's test program, thanks! + (g_io_win32_prepare): Return value that takes the buffer condition + into account, like g_io_unix_prepare() does. + (g_io_win32_check): Ditto, like g_io_unix_check(). + Thu Mar 14 17:37:45 2002 Owen Taylor * glib/giochannel.c (g_io_channel_write_chars): Fix some diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index d4db8f4..268fa9f 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,12 @@ +2002-03-16 Tor Lillqvist + + * glib/giowin32.c: Some debugging output formatting changes. The + following two changes fixes a problem with buffered GIOChannels, + noticed with the help of Owen's test program, thanks! + (g_io_win32_prepare): Return value that takes the buffer condition + into account, like g_io_unix_prepare() does. + (g_io_win32_check): Ditto, like g_io_unix_check(). + Thu Mar 14 17:37:45 2002 Owen Taylor * glib/giochannel.c (g_io_channel_write_chars): Fix some diff --git a/glib/giowin32.c b/glib/giowin32.c index 9f20a08..513ace9 100644 --- a/glib/giowin32.c +++ b/glib/giowin32.c @@ -221,7 +221,7 @@ read_thread (void *parameter) g_io_channel_ref ((GIOChannel *)channel); if (channel->debug) - g_print ("read_thread %#x: start fd:%d, data_avail:%#x, space_avail:%#x\n", + g_print ("read_thread %#x: start fd:%d, data_avail:%#x space_avail:%#x\n", channel->thread_id, channel->fd, (guint) channel->data_avail_event, @@ -419,7 +419,7 @@ select_thread (void *parameter) g_io_channel_ref ((GIOChannel *)channel); if (channel->debug) - g_print ("select_thread %#x: start fd:%d,\n\tdata_avail:%#x, data_avail_noticed:%#x\n", + g_print ("select_thread %#x: start fd:%d data_avail:%#x data_avail_noticed:%#x\n", channel->thread_id, channel->fd, (guint) channel->data_avail_event, @@ -482,8 +482,7 @@ select_thread (void *parameter) channel->revents |= G_IO_ERR; if (channel->debug) - g_print ("select_thread %#x: resetting data_avail_noticed,\n" - "\tsetting data_avail\n", + g_print ("select_thread %#x: resetting data_avail_noticed, setting data_avail\n", channel->thread_id); ResetEvent (channel->data_avail_noticed_event); SetEvent (channel->data_avail_event); @@ -537,15 +536,27 @@ g_io_win32_prepare (GSource *source, gint *timeout) { GIOWin32Watch *watch = (GIOWin32Watch *)source; + GIOCondition buffer_condition = g_io_channel_get_buffer_condition (watch->channel); GIOWin32Channel *channel = (GIOWin32Channel *)watch->channel; *timeout = -1; + if (channel->debug) + g_print ("g_io_win32_prepare: for thread %#x buffer_condition:%#x\n" + " watch->pollfd.events:%#x watch->pollfd.revents:%#x channel->revents:%#x\n", + channel->thread_id, buffer_condition, + watch->pollfd.events, watch->pollfd.revents, channel->revents); + if (channel->type == G_IO_WIN32_FILE_DESC) { LOCK (channel->mutex); if (channel->running && channel->wrp == channel->rdp) - channel->revents = 0; + { + if (channel->debug) + g_print ("g_io_win32_prepare: for thread %#x, setting channel->revents = 0\n", + channel->thread_id); + channel->revents = 0; + } UNLOCK (channel->mutex); } else if (channel->type == G_IO_WIN32_SOCKET) @@ -553,7 +564,7 @@ g_io_win32_prepare (GSource *source, channel->revents = 0; if (channel->debug) - g_print ("g_io_win32_prepare: thread %#x, setting data_avail_noticed\n", + g_print ("g_io_win32_prepare: for thread %#x, setting data_avail_noticed\n", channel->thread_id); SetEvent (channel->data_avail_noticed_event); if (channel->debug) @@ -561,11 +572,7 @@ g_io_win32_prepare (GSource *source, channel->thread_id); } - return FALSE; - /* XXX: why should we want to do this ? */ - watch->condition = g_io_channel_get_buffer_condition (watch->channel); - - return (watch->pollfd.revents & (G_IO_IN | G_IO_OUT)) == watch->condition; + return ((watch->condition & buffer_condition) == watch->condition); } static gboolean @@ -577,9 +584,9 @@ g_io_win32_check (GSource *source) GIOCondition buffer_condition = g_io_channel_get_buffer_condition (watch->channel); if (channel->debug) - g_print ("g_io_win32_check: for thread %#x:\n" - "\twatch->pollfd.events:%#x, watch->pollfd.revents:%#x, channel->revents:%#x\n", - channel->thread_id, + g_print ("g_io_win32_check: for thread %#x buffer_condition:%#x\n" + " watch->pollfd.events:%#x watch->pollfd.revents:%#x channel->revents:%#x\n", + channel->thread_id, buffer_condition, watch->pollfd.events, watch->pollfd.revents, channel->revents); if (channel->type != G_IO_WIN32_WINDOWS_MESSAGES) @@ -602,7 +609,7 @@ g_io_win32_check (GSource *source) channel->thread_id); } - return (watch->pollfd.revents & watch->condition); + return ((watch->pollfd.revents | buffer_condition) & watch->condition); } static gboolean