Re: Two problems: GtkEntry focus without cursor - fork usage



On Mon, 19 Nov 2001, Peter Rottengatter wrote:

The second problem is on using the fork() call to spawn another process.
Defining a subroutine
int test(void)
{
   if ((exec_child = fork()) != 0)
     {
        return ((exec_child == -1) ? TRUE : FALSE);
      }

   exit (0);
 }
one would expect that by calling it spawns a child that doesn't do much but
terminate immediately without affecting the main process. This is what it 
does if it is called from main() before gtk_init. If it is called from main() 
after that point, it appears to work alright, however the app terminates at
the moment gtk_main is called, without any window appearing. If it is called
from a button-clicked handler (which was my original intention), the entire
application terminates at the moment the child calls exit(0). This is evident
from inserting a sleep(10) before the exit call.

http://www.gtk.org/faq/#AEN472

/ Alex





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