7 use Thread::Cleanup::TestThreads;
9 use Test::More 'no_plan';
18 Thread::Cleanup::register {
19 my $tid = threads->tid;
31 is $x, $num, "\$x in destructor of thread $tid";
40 my $tid = threads->tid;
50 is $x, $y, "\$x in thread $tid";
60 my @tids = map $_->tid, @threads;
62 $_->join for @threads;
64 is $x, -1, '$x in the main thread';
67 is $ran{$_}, 1, "thread $_ was run once";
68 is $called{$_}, 1, "thread $_ destructor was called once";