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;
28 Thread::Cleanup::register {
29 my $tid = threads->tid;
41 is $x, $num, "\$x in destructor of thread $tid";
50 my $tid = threads->tid;
60 is $x, $y, "\$x in thread $tid";
68 my $thr = threads->create(\&cb, $_);
69 push @tids, $thr->tid;
73 diag "Using threads $threads::VERSION";
74 diag "Using threads::shared $threads::shared::VERSION";
78 is $x, -1, '$x in the main thread';
81 is $ran{$_}, 1, "thread $_ was run once";
82 is $called{$_}, 1, "thread $_ destructor was called once";