Invoking[Fork and exec] a new script from main GUI, freezes parent UI application....

Hi All,
I have an application, in which there is a menu item to display a log window. This log[textview] window shows all the log debugs collected so far from the application. All the log debugs are written to a file by the main application and this text window displays the contents of that log file.

Currently, whenever the menu item is clicked, I am forking and execing a script to display this text window.
However, whenever the menu item is clicked, I observe that my main UI freezes.

Below is a code extract on how I am doing fork and exec, whenver the menu item is clicked:
    my $pid = fork();

    if ( $pid ) {
        print "This is parent\n";
        return 1;
    } else {
        print "This is child\n";
        my $pid1 = exec(" --file $LOG_FILE");
        return 1;

, where displays the text window and the contents of the log file.

My main UI application itself, typically takes around 3minutes to start.  I am not sure on the exact reason, why it takes a long time. But possiblities are: a. The main application has close to 50,000 lines of code, b.  A number of external Perl modules are used.

Would this a possible reason, why my main UI freezes, when a fork and exec happens?

Any pointers in this regard will be highly appreciated. Please let me know if more inputs are required.

Also, is there any other way in which this can be done? Would it a good idea, to have
the text window to be a part of the main UI application itself?


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