Re: Multithreading

There were several replys, so i post this to the List.

This is the code i use to fork:
    if (my $pid = fork) {
        # we are the parent
    } elsif (defined $pid) { # $pid is zero here if defined
        # we are the child
        setsid( );
        if($d){print "Forking!\n"};
        if (defined $win) { $win->destroy; $win = undef }
    } elsif ($! =~ /No more process/) {
        sleep 5;
        redo FORK;
    } else {
        # weird fork error
        die "Can't fork: $!\n";

# open new window....

And this is it's crash, note that only the Parent crashes, the child is still 

The program 'gtk-gallery' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadDrawable (invalid Pixmap or Window parameter)'.
  (Details: serial 5191 error_code 9 request_code 70 minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)

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