Re: Fork with gtk+-2.0



On Tue, 06 Jan 2004 12:32:26 +0100
GЭnther Rapp <guenther rapp-informatik de> wrote:

there are only  a few lines of code the thread is started in the main
like this 
     
        pthread_create(&yacc_tid, NULL, argument_thread, NULL);
        gtk_signal_connect (GTK_OBJECT (main_window), "destroy",
                      GTK_SIGNAL_FUNC (gtk_main_quit),
                      NULL);
        gdk_threads_enter();
        gtk_main ();
        gdk_threads_leave();
        _exit(0);

the fork should be started in a callback
/*
                strcpy(command,"x_ray_start ");
                strcat(command,nr_patient);
                strcat(command," '");
                strcat(command,name_patient);      THIS WORKS well
                strcat(command," ");
                strcat(command,vorn_patient);
                strcat(command,"'");
                strcat(command,"&");
                system (command);
*/

                {
                char name_p[128];
                strcpy(name_p,name_patient);
                strcat(name_p," ");
                strcat(name_p,vorn_patient);
                strcat(name_p," ");                   
                strcat(name_p,geb_patient);
                switch( multixraypid = fork() ) {      /* !!!! this does
not work with activ THREADS WHY ??? */
                case -1:
                        BOTCH("XRAY : fork failed");
                case 0:                             /* this is the son
exec a new task */
                        setpgrp();
                       
execlp("x_ray_start","x_ray_start",nr_patient,name_p,(char *)0);
                        _exit(0);
                default:                            /* this is the
father */
                        ;;
                }

I'm think that it trouble with threads realization in GLib, try to use standart unix 
threads, I'm test using fork() and threads(standart unix threads) and it work.

-- 
Alphex Kaanoken
Senior developer of Crew IT research labs
web: http://crew.org.ru
mailto:Alphex Crew Org RU



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