GIOChannel



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello all,

I'm using the following code fragment

    ok = g_spawn_async_with_pipes("/tmp", argv, NULL,
                G_SPAWN_SEARCH_PATH,
                NULL, NULL, NULL,
                &std_in, &std_out, &std_err,
                NULL);

    channel_out = g_io_channel_unix_new(std_in);
    channel_in = g_io_channel_unix_new(std_out);
    channel_err = g_io_channel_unix_new(std_err);
    g_io_channel_set_close_on_unref (channel_in, TRUE);
    g_io_channel_set_close_on_unref (channel_err, TRUE);
    g_io_add_watch(channel_in,G_IO_IN , thread_reader,NULL);
    g_io_add_watch(channel_err, G_IO_ERR , thread_reader,NULL);


And this is the callback.

gboolean thread_reader(GIOChannel *source, GIOCondition condition,
gpointer data) {

    GString *_output;
    GIOStatus status;

    output = g_string_new("");

    status = g_io_channel_read_line_string(source,output,NULL,NULL);
    if (status == G_IO_STATUS_EOF) {
        g_io_channel_close(source);
        g_io_channel_unref(source);
        return FALSE;
    }

}

It all works and my thread_reader is being called properly, but when I
do this the performance of the GUI is aweful, can't resize the window,
etc.... The second I kill the spawned app the performance returns back
to normal. Is there anything I can to to make this work better. My app
that I am spawning is very chatty, and so there is a lot of output being
processed, so I don't think it is hanging on the read_line.

TIA,

Kevin

- --
Get my public GnuPG key from
http://keyserver.veridis.com:11371/export?id=-1509369771935935023
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFFPtvM6w2kMH0L1dERAr+0AJ961eqC0YLq5OJ5ItwFGqAH8xuYsgCeIdZ5
8s5TVtNF0KhjUk2WrLZqaWg=
=8KTg
-----END PGP SIGNATURE-----



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