What is wrong with fork?

use Win32; my $pid = fork(); die "Could not fork Fork!" unless defined $pid; if ( $pid ) { # Parent makes whoopee while kids are away do {print $come_to_momma_honey++ . "\n"; sleep 1 } while 1; } else { # kid so do the MsgBox Win32::MsgBox("My parent's are getting up to mischief while I am w +aiting for you to press OK!"); die "You killed me. Your own flesh and blood!\n"; }

I am on Win2K and this works fine. The count goes on while the message box waits. Parent continues after you press OK while the kid exits. See some other fork examples at My children are driving me crazy Forked off! and Forked up with a bit of explanation.

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print


In reply to Re: Show a msgbox and do not wait (Win32) by tachyon
in thread Show a msgbox and do not wait (Win32) by Jenda

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.