7 use Thread::Cleanup::TestThreads;
9 use Test::More 'no_plan';
18 Thread::Cleanup::register {
19 my $tid = threads->tid;
30 is $x, $num, "\$x in destructor of thread $tid";
39 my $tid = threads->tid;
49 is $x, $y, "\$x in thread $tid";
60 my @tids = map $_->tid, @threads;
62 $_->detach for @threads;
66 is $x, -1, '$x in the main thread';
69 is $ran{$_}, 1, "thread $_ was run once";
70 is $called{$_}, undef, "thread $_ destructor wasn't called yet";
74 is $called{$_}, 1, "thread $_ destructor was called once at END time"