g_spawn_async blocking issue



Well, I was just wondering about g_spawn_with_pipes..  I use it to execute
an external program for me..  Under FreeBSD (at least) when it is run at
the same time i got sound playing with a thread through ESD.. the
g_spawn.. seems to block the main process.

   The only solution I found to make it stop blocking was with some code
similar to the following:

if (fork() == 0) {
    register int cnt;

    /* close all the fds in the child to prevent it from hogging thea udio
device */
    for (cnt = 3; cnt < 255; cnt++)
         close(cnt);

    exec...
    _exit(0);
}

and well, now it does not block.  I was just wondering if there is some
similar code in the gspawn part in the glib, but I have not checked
myself.  I think there should be something like this, since this forked
child should not need those fds anyway..


Sincerely,
Gunnsteinn Hall





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