mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-12 20:36:15 +01:00
New function, that calls g_source_remove(). Check return value of
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.
This commit is contained in:
parent
042179dad8
commit
3d6f441f96
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
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>
|
Sun Aug 6 20:06:02 2000 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
* gmessages.c (g_log_domain_check_free): keep *last updated while
|
* gmessages.c (g_log_domain_check_free): keep *last updated while
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
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>
|
Sun Aug 6 20:06:02 2000 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
* gmessages.c (g_log_domain_check_free): keep *last updated while
|
* gmessages.c (g_log_domain_check_free): keep *last updated while
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
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>
|
Sun Aug 6 20:06:02 2000 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
* gmessages.c (g_log_domain_check_free): keep *last updated while
|
* gmessages.c (g_log_domain_check_free): keep *last updated while
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
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>
|
Sun Aug 6 20:06:02 2000 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
* gmessages.c (g_log_domain_check_free): keep *last updated while
|
* gmessages.c (g_log_domain_check_free): keep *last updated while
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
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>
|
Sun Aug 6 20:06:02 2000 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
* gmessages.c (g_log_domain_check_free): keep *last updated while
|
* gmessages.c (g_log_domain_check_free): keep *last updated while
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
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>
|
Sun Aug 6 20:06:02 2000 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
* gmessages.c (g_log_domain_check_free): keep *last updated while
|
* gmessages.c (g_log_domain_check_free): keep *last updated while
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
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>
|
Sun Aug 6 20:06:02 2000 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
* gmessages.c (g_log_domain_check_free): keep *last updated while
|
* gmessages.c (g_log_domain_check_free): keep *last updated while
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
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>
|
Sun Aug 6 20:06:02 2000 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
* gmessages.c (g_log_domain_check_free): keep *last updated while
|
* gmessages.c (g_log_domain_check_free): keep *last updated while
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* A test program for the main loop and IO channel code.
|
/* 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"
|
#include "config.h"
|
||||||
@ -93,6 +93,16 @@ read_all (int fd,
|
|||||||
return error;
|
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
|
static gboolean
|
||||||
recv_message (GIOChannel *channel,
|
recv_message (GIOChannel *channel,
|
||||||
@ -100,6 +110,7 @@ recv_message (GIOChannel *channel,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
gint fd = g_io_channel_unix_get_fd (channel);
|
gint fd = g_io_channel_unix_get_fd (channel);
|
||||||
|
gboolean retval = TRUE;
|
||||||
|
|
||||||
g_print ("gio-test: ...from %d:%s%s%s%s\n", fd,
|
g_print ("gio-test: ...from %d:%s%s%s%s\n", fd,
|
||||||
(cond & G_IO_ERR) ? " ERR" : "",
|
(cond & G_IO_ERR) ? " ERR" : "",
|
||||||
@ -109,10 +120,8 @@ recv_message (GIOChannel *channel,
|
|||||||
|
|
||||||
if (cond & (G_IO_ERR | G_IO_HUP))
|
if (cond & (G_IO_ERR | G_IO_HUP))
|
||||||
{
|
{
|
||||||
g_source_remove (*(guint *) data);
|
shutdown_source (data);
|
||||||
nrunning--;
|
retval = FALSE;
|
||||||
if (nrunning == 0)
|
|
||||||
g_main_quit (main_loop);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cond & G_IO_IN)
|
if (cond & G_IO_IN)
|
||||||
@ -129,6 +138,7 @@ recv_message (GIOChannel *channel,
|
|||||||
if (nb == 0)
|
if (nb == 0)
|
||||||
{
|
{
|
||||||
g_print ("gio-test: ...from %d: EOF\n", fd);
|
g_print ("gio-test: ...from %d: EOF\n", fd);
|
||||||
|
shutdown_source (data);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +149,7 @@ recv_message (GIOChannel *channel,
|
|||||||
{
|
{
|
||||||
if (seq != seqtab[i].seq)
|
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);
|
seq, seqtab[i].seq);
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
@ -156,6 +166,7 @@ recv_message (GIOChannel *channel,
|
|||||||
if (nb == 0)
|
if (nb == 0)
|
||||||
{
|
{
|
||||||
g_print ("gio-test: ...from %d: EOF\n", fd);
|
g_print ("gio-test: ...from %d: EOF\n", fd);
|
||||||
|
shutdown_source (data);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,6 +191,7 @@ recv_message (GIOChannel *channel,
|
|||||||
if (nb == 0)
|
if (nb == 0)
|
||||||
{
|
{
|
||||||
g_print ("gio-test: ...from %d: EOF\n", fd);
|
g_print ("gio-test: ...from %d: EOF\n", fd);
|
||||||
|
shutdown_source (data);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +205,7 @@ recv_message (GIOChannel *channel,
|
|||||||
g_print ("gio-test: ...from %d: OK\n", fd);
|
g_print ("gio-test: ...from %d: OK\n", fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
Reference in New Issue
Block a user