2 # test that END blocks are run in the thread that created them and
3 # not in any child threads
8 require Config; import Config;
9 unless ($Config{'useithreads'}) {
10 print "1..0 # Skip: no useithreads\n";
15 use ExtUtils::testlib;
17 BEGIN { print "1..6\n" };
23 use Devel::Peek qw(Dump);
28 # You have to do it this way or VMS will get confused.
29 print $ok ? "ok $test_id - $name\n" : "not ok $test_id - $name\n";
31 printf "# Failed test at line %d\n", (caller)[2] unless $ok;
36 END { ok(1,"End block run once") }
37 threads->create(sub { eval "END { ok(1,'') }"})->join();
38 threads->create(sub { eval "END { ok(1,'') }"})->join();
39 threads->create(\&thread)->join();
42 eval "END { ok(1,'') }";
43 threads->create(sub { eval "END { ok(1,'') }"})->join();