Here is my question Oh Monks! I'm trying to launch a tk dialog box to tell the user to wait until what i'm processing is done. To do this i'm forking the main program. The child process creates a main window that shows a please wait message. Once the parent process finishes what it does it tries to kill the child. What happens then is that although the program does not exit, i get this error message:

XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":0.0" after 570 requests (559 known processed) with 0 events remaining.

and also it won't fire another tk main window. In the code below the call to resultsTk is ignored.

Here is my code:

my $pid = fork(); if(!defined($pid)){ print "Couldn't fork , continue"; } elsif($pid == 0){ &waitTk(); } else{ print $pid."\n"; my $min=$max; my $count=0; my $bpSum=0; foreach my $accID (keys %accDict){ #here do things sleep(20); } kill(1,$pid); waitpid($pid,0); #don't know if it's needed.Here just in case print "it got killed"; print $min."\n"; print $max."\n"; &resultsTk($min,$max); } sub resultsTk{ my ($rMin,$rMax) = @_; my $main = MainWindow->new(); $main->withdraw; my $dialog = $main->DialogBox(-buttons=>["Ok"]); $dialog->add("Label",-text=>"Min: $rMin, Max: $rMax")->pack(); my $button=$dialog->Show(); if($button eq "Ok"){ exit(0); } } sub waitTk{ local $SIG{HUP} =sub{exit(0);}; my $main = MainWindow->new(); $main->withdraw; my $dialog = $main->DialogBox(); $dialog->add("Label",-text=>"Please wait, calculating.")->pack(); my $button=$dialog->Show(); } Result: _TK_EXIT_(0) it got killed379 5168 XIO: fatal IO error 11 (Resource temporarily unavailable) on X server + ":0.0" after 570 requests (559 known processed) with 0 events remaining +.

In reply to killing a child process which contains a Tk Main window by vchristaras

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.