-#!perl -T
+#!perl
use strict;
use warnings;
-use lib 't/lib';
-use Variable::Magic::TestThreads;
-
-use Test::More 'no_plan';
-
use Variable::Magic qw<
wizard cast dispell getdata
VMG_OP_INFO_NAME VMG_OP_INFO_OBJECT
>;
+use lib 't/lib';
+use VPIT::TestHelpers (
+ threads => [ 'Variable::Magic' => 'Variable::Magic::VMG_THREADSAFE()' ],
+);
+
+use Test::Leaner 'no_plan';
+
my $destroyed : shared = 0;
my $c : shared = 0;
}
}
- return;
+ return 1;
}
my $wiz_name = spawn_wiz VMG_OP_INFO_NAME;
$destroyed = 0;
}
+ my $completed = 0;
+
my @threads = map spawn(\&try, $dispell, $wiz), 1 .. 2;
- $_->join for @threads;
+ for my $thr (@threads) {
+ my $res = $thr->join;
+ $completed += $res if defined $res;
+ }
{
lock $c;
- is $c, 2, "get triggered twice";
+ is $c, $completed, "get triggered twice";
}
{
lock $destroyed;
- is $destroyed, (1 - $dispell) * 2, 'destructors';
+ is $destroyed, (1 - $dispell) * $completed, 'destructors';
}
}
}