6 use Config qw/%Config/;
9 if (!$Config{useithreads}) {
12 plan(skip_all => 'This perl wasn\'t built to support threads');
19 use Test::More tests => 5 * (2 + 2) + 1;
22 defined and diag "Using threads $_" for $threads::VERSION;
23 defined and diag "Using threads::shared $_" for $threads::shared::VERSION;
33 Thread::Cleanup::register {
34 my $tid = threads->tid;
46 is $x, $num, "\$x in destructor of thread $tid";
55 my $tid = threads->tid;
65 is $x, $y, "\$x in thread $tid";
73 my $thr = threads->create(\&cb, $_);
74 push @tids, $thr->tid;
80 is $x, -1, '$x in the main thread';
83 is $ran{$_}, 1, "thread $_ was run once";
84 is $called{$_}, 1, "thread $_ destructor was called once";