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 + 1;
22 defined and diag "Using threads $_" for $threads::VERSION;
23 defined and diag "Using threads::shared $_" for $threads::shared::VERSION;
30 sub msg { lock @stack; push @stack, join ':', @_ }
32 Thread::Cleanup::register {
39 local $SIG{__DIE__} = sub { msg 'sig', @_ };
40 no warnings 'threads';
52 is shift(@stack), 'spawn';
53 like shift(@stack), qr/sig:thread at \Q$0\E line \d+/;
54 is shift(@stack), 'cleanup';
55 like shift(@stack), qr/sig:cleanup at \Q$0\E line \d+/;
56 is shift(@stack), 'done';
57 is_deeply \@stack, [ ], 'nothing more';