X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FVariable-Magic.git;a=blobdiff_plain;f=t%2F40-threads.t;h=151116bab11f44b9aebe5b25a1e6240380d8576a;hp=9b2d2fa2c95fd59bfbf691ab9413cea011703006;hb=b1c264655ccc1eca4423e9dd9479855938bbac24;hpb=6f9e4d15e5b78907f2bc9abe93719ae0c35af4fa diff --git a/t/40-threads.t b/t/40-threads.t index 9b2d2fa..151116b 100644 --- a/t/40-threads.t +++ b/t/40-threads.t @@ -102,7 +102,8 @@ sub try { is $c, 1, "get in thread $tid after dispell doesn't trigger magic"; } } - return; # Ugly if not here + + return 1; } for my $dispell (1, 0) { @@ -111,11 +112,16 @@ for my $dispell (1, 0) { $destroyed = 0; } + my $completed = 0; + my @threads = map spawn(\&try, $dispell, $_), ('name') x 2, ('object') x 2; - $_->join for @threads; + for my $thr (@threads) { + my $res = $thr->join; + $completed += $res if defined $res; + } { lock $destroyed; - is $destroyed, (1 - $dispell) * 4, 'destructors'; + is $destroyed, (1 - $dispell) * $completed, 'destructors'; } }