I wonder if sleep is broken or if the box is busy or delays coming from Windows anti-malware? Looking at tests 4, 5, and 8.

perl -Ilib t/05_mce_child.t ... ok 2 - spawning asynchronously ok 3 - check for unique pids ok 4 - check list_running ok 5 - check list_joinable ok 6 - check list ok 7 - check pending ok 8 - check is_running child1 ok 9 - check is_joinable child1 ok 10 - check is_running child2 ok 11 - check is_joinable child2 ok 12 - check is_running child3 ok 13 - check is_joinable child3 ...

Is there an alternative to sleep on the Windows platform, ensuring delay before the workers exit?

{ my ( $cnt, @list, %pids, %ret ); local $_; my ( $come_then_i_pray ) = ( "さあ、私&#123 +99;祈る" . "Ǣ" ); ok( 1, "spawning asynchronously" ); # test 2 MCE::Child->create( sub { sleep 1; sleep 1; "$come_then_i_pray $_" +} ) for ( 1..3 ); %pids = map { $_ => undef } MCE::Child->list_pids; is ( scalar( keys %pids ), 3, 'check for unique pids' ); # test 3 @list = MCE::Child->list_running; is ( scalar @list, 3, 'check list_running' ); # test 4 @list = MCE::Child->list_joinable; is ( scalar @list, 0, 'check list_joinable' ); # test 5 @list = MCE::Child->list; is ( scalar @list, 3, 'check list' ); # test 6 is ( MCE::Child->pending, 3, 'check pending' ); # test 7 $cnt = 0; for ( @list ) { ++$cnt; is ( $_->is_running, 1, 'check is_running child'.$cnt ); # te +sts 8, 10, 12 is ( $_->is_joinable, '', 'check is_joinable child'.$cnt ); # te +sts 9, 11, 13 } $cnt = 0; for ( @list ) { ++$cnt; $ret{ $_->join } = 1; is ( $_->error, undef, 'check error child'.$cnt ); } is ( scalar keys %ret, 3, 'check for unique values' ); for ( sort keys %ret ) { my $id = chop; s/ $//; is ( $_, $come_then_i_pray, "check for utf8 string $id" ); }; }

Update 1: I have an idea to not use sleep. Instead, I will have workers read a channel. The manager process will notify workers to exit after completing tests list_running, list_joinable, list, pending, is_running, and is_joinable.

Update 2: Released MCE 1.883 on meta::cpan


In reply to Re^3: fork() on win10 - MCE (released 1.883 update) by marioroy
in thread fork() on win10 by BernieC

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.