-#!perl -T
+#!perl
use strict;
use warnings;
use lib 't/lib';
-use Scope::Upper::TestThreads;
+use VPIT::TestHelpers (
+ threads => [ 'Scope::Upper' => 'Scope::Upper::SU_THREADSAFE()' ],
+ 'usleep',
+);
use Test::Leaner;
local $z = $tid;
my $p = "[$tid] up1";
- usleep rand(1e6);
+ usleep rand(2.5e5);
my @res = (
-1,
);
is_deeply \@res, [ -1, $tid .. $tid + 2, -2 ], "$p: unwinded correctly";
+
+ return 1;
}
my @threads = map spawn(\&up1), 1 .. 30;
-$_->join for @threads;
+my $completed = 0;
+for my $thr (@threads) {
+ ++$completed if $thr->join;
+}
pass 'done';
-done_testing(scalar(@threads) + 1);
+done_testing($completed + 1);