+2000-08-07 Tor Lillqvist <tml@iki.fi>
+
+ * tests/gio-test.c (shutdown_source): New function, that calls
+ g_source_remove(). Check return value of g_source_remove(), and
+ decrement running subprocess counter only if g_source_remove()
+ actually did remove the source.
+
+ (recv_message): Call shutdown_source() on EOF condition. Return
+ FALSE on G_IO_HUP and G_IO_ERR condition. Fix printf format typo.
+
Sun Aug 6 20:06:02 2000 Tim Janik <timj@gtk.org>
* gmessages.c (g_log_domain_check_free): keep *last updated while
+2000-08-07 Tor Lillqvist <tml@iki.fi>
+
+ * tests/gio-test.c (shutdown_source): New function, that calls
+ g_source_remove(). Check return value of g_source_remove(), and
+ decrement running subprocess counter only if g_source_remove()
+ actually did remove the source.
+
+ (recv_message): Call shutdown_source() on EOF condition. Return
+ FALSE on G_IO_HUP and G_IO_ERR condition. Fix printf format typo.
+
Sun Aug 6 20:06:02 2000 Tim Janik <timj@gtk.org>
* gmessages.c (g_log_domain_check_free): keep *last updated while
+2000-08-07 Tor Lillqvist <tml@iki.fi>
+
+ * tests/gio-test.c (shutdown_source): New function, that calls
+ g_source_remove(). Check return value of g_source_remove(), and
+ decrement running subprocess counter only if g_source_remove()
+ actually did remove the source.
+
+ (recv_message): Call shutdown_source() on EOF condition. Return
+ FALSE on G_IO_HUP and G_IO_ERR condition. Fix printf format typo.
+
Sun Aug 6 20:06:02 2000 Tim Janik <timj@gtk.org>
* gmessages.c (g_log_domain_check_free): keep *last updated while
+2000-08-07 Tor Lillqvist <tml@iki.fi>
+
+ * tests/gio-test.c (shutdown_source): New function, that calls
+ g_source_remove(). Check return value of g_source_remove(), and
+ decrement running subprocess counter only if g_source_remove()
+ actually did remove the source.
+
+ (recv_message): Call shutdown_source() on EOF condition. Return
+ FALSE on G_IO_HUP and G_IO_ERR condition. Fix printf format typo.
+
Sun Aug 6 20:06:02 2000 Tim Janik <timj@gtk.org>
* gmessages.c (g_log_domain_check_free): keep *last updated while
+2000-08-07 Tor Lillqvist <tml@iki.fi>
+
+ * tests/gio-test.c (shutdown_source): New function, that calls
+ g_source_remove(). Check return value of g_source_remove(), and
+ decrement running subprocess counter only if g_source_remove()
+ actually did remove the source.
+
+ (recv_message): Call shutdown_source() on EOF condition. Return
+ FALSE on G_IO_HUP and G_IO_ERR condition. Fix printf format typo.
+
Sun Aug 6 20:06:02 2000 Tim Janik <timj@gtk.org>
* gmessages.c (g_log_domain_check_free): keep *last updated while
+2000-08-07 Tor Lillqvist <tml@iki.fi>
+
+ * tests/gio-test.c (shutdown_source): New function, that calls
+ g_source_remove(). Check return value of g_source_remove(), and
+ decrement running subprocess counter only if g_source_remove()
+ actually did remove the source.
+
+ (recv_message): Call shutdown_source() on EOF condition. Return
+ FALSE on G_IO_HUP and G_IO_ERR condition. Fix printf format typo.
+
Sun Aug 6 20:06:02 2000 Tim Janik <timj@gtk.org>
* gmessages.c (g_log_domain_check_free): keep *last updated while
+2000-08-07 Tor Lillqvist <tml@iki.fi>
+
+ * tests/gio-test.c (shutdown_source): New function, that calls
+ g_source_remove(). Check return value of g_source_remove(), and
+ decrement running subprocess counter only if g_source_remove()
+ actually did remove the source.
+
+ (recv_message): Call shutdown_source() on EOF condition. Return
+ FALSE on G_IO_HUP and G_IO_ERR condition. Fix printf format typo.
+
Sun Aug 6 20:06:02 2000 Tim Janik <timj@gtk.org>
* gmessages.c (g_log_domain_check_free): keep *last updated while
+2000-08-07 Tor Lillqvist <tml@iki.fi>
+
+ * tests/gio-test.c (shutdown_source): New function, that calls
+ g_source_remove(). Check return value of g_source_remove(), and
+ decrement running subprocess counter only if g_source_remove()
+ actually did remove the source.
+
+ (recv_message): Call shutdown_source() on EOF condition. Return
+ FALSE on G_IO_HUP and G_IO_ERR condition. Fix printf format typo.
+
Sun Aug 6 20:06:02 2000 Tim Janik <timj@gtk.org>
* gmessages.c (g_log_domain_check_free): keep *last updated while
*/
/* A test program for the main loop and IO channel code.
- * Just run it.
+ * Just run it. Optional parameter is number of sub-processes.
*/
#include "config.h"
return error;
}
+static void
+shutdown_source (gpointer data)
+{
+ if (g_source_remove (*(guint *) data))
+ {
+ nrunning--;
+ if (nrunning == 0)
+ g_main_quit (main_loop);
+ }
+}
static gboolean
recv_message (GIOChannel *channel,
gpointer data)
{
gint fd = g_io_channel_unix_get_fd (channel);
+ gboolean retval = TRUE;
g_print ("gio-test: ...from %d:%s%s%s%s\n", fd,
(cond & G_IO_ERR) ? " ERR" : "",
if (cond & (G_IO_ERR | G_IO_HUP))
{
- g_source_remove (*(guint *) data);
- nrunning--;
- if (nrunning == 0)
- g_main_quit (main_loop);
+ shutdown_source (data);
+ retval = FALSE;
}
if (cond & G_IO_IN)
if (nb == 0)
{
g_print ("gio-test: ...from %d: EOF\n", fd);
+ shutdown_source (data);
return FALSE;
}
{
if (seq != seqtab[i].seq)
{
- g_print ("gio-test: ...from &d: invalid sequence number %d, expected %d\n",
+ g_print ("gio-test: ...from %d: invalid sequence number %d, expected %d\n",
seq, seqtab[i].seq);
g_assert_not_reached ();
}
if (nb == 0)
{
g_print ("gio-test: ...from %d: EOF\n", fd);
+ shutdown_source (data);
return FALSE;
}
if (nb == 0)
{
g_print ("gio-test: ...from %d: EOF\n", fd);
+ shutdown_source (data);
return FALSE;
}
g_print ("gio-test: ...from %d: OK\n", fd);
}
}
- return TRUE;
+ return retval;
}
int