Re: GIOChannel



Kevin DeKorte wrote:
-----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);

This looks strange here - you are watching for a readable condition
on the child process's stdin - I would expect you to be writing to
that file descriptor.

Then you go and watch for error conditions on stderr - wouldnt you
want to be checking for input on stdout & stderr instead ?

Its possible that the child process's stdin is constantly "ready to read"
(maybe thats a long shot), but leaking a GString in an idle handler
should effectively slow down your app I would expect.

Cheers,
                      -Tristan



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