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

Re: Fork with gtk+-2.0



On Mon, 5 Jan 2004, Roland Smith wrote:

> On Mon, 5 Jan 2004 15:04:15 +0300
> "Alphex K." <alphex@crew.org.ru> wrote:
>
> > pid_t pid;
> > pid = fork();
> >
> > if ((pid=fork())==0)
> > 	execlp("/bin/xvkbd", "-geometry 800x185-0-0", NULL);
> > else
> > 	g_print("Fork failed\n");
> > }

Not to note that you fork twice!  And fork returns -1 on error.



> You've left out a lot of details. You need to register a singal handler for
> SIGCHLD. If you want to communitate with the child process, you have to setup
> pipes etc.
>
> It's better to use one of g_spawn_async or g_spawn_async_with_pipes or
> g_spawn_command_line_async. They take care of a lot of the details for you.
>
> Roland



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