Re: fork in callbacks




"Rodrigo Moya" <Moya_Rodrigo/madrid_tecnologia@sinvest.es> writes:

> Hi all!
> 
> Can I fork() inside a (GNOME) widget callback?, for example:
> 
>     void checkout_dialog_cb (GtkWidget *w, gint button_number, gpointer
> data)
>     {
>       GtkWidget *dialog = GTK_WIDGET(data);
>       g_return_if_fail(dialog != NULL);
>       switch (button_number)
>       {
>           case 0 : // 'Ok' button
>               switch (fork())
>               {
>                   ..............whatever()..................
>               }
>               break;
>           case 1 : // 'Cancel' button
>               gtk_widget_destroy(dialog);
>               break;
>       }
>     }
> 
> This is a callback for a GnomeDialog widget.

Yes, as long as you:

 - Make no libgnomeui or GTK+ calls in the child process

 - Exit the child process with _exit() instead of exit().

Regards,
                                        Owen



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