From: Vincent Pit Date: Mon, 3 Aug 2015 17:09:01 +0000 (-0300) Subject: Port t/79-uid-threads.t to the new threads interface X-Git-Tag: v0.28~9 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FScope-Upper.git;a=commitdiff_plain;h=ba6783aa6d08cd998143a4b4cb0d7516597dfc51 Port t/79-uid-threads.t to the new threads interface For some reason it was still calling threads->create(). This commit also makes sure that the test is resilient to stray exits. --- diff --git a/t/79-uid-threads.t b/t/79-uid-threads.t index 81321c1..817a144 100644 --- a/t/79-uid-threads.t +++ b/t/79-uid-threads.t @@ -37,14 +37,16 @@ sub cb { my %uids; my $threads = 0; -for my $thread (map threads->create(\&cb), 1 .. 30) { - ++$threads; +for my $thread (map spawn(\&cb), 1 .. 30) { my $tid = $thread->tid; my $uid = $thread->join; - ++$uids{$uid}; - ok !validate_uid($uid), "\$here is no longer valid (out of thread $tid)"; + if (defined $uid) { + ++$threads; + ++$uids{$uid}; + ok !validate_uid($uid), "\$here is no longer valid (out of thread $tid)"; + } } is scalar(keys %uids), $threads, 'all the UIDs were different'; -done_testing($threads * 5 + 1); +done_testing;