5 if ($ENV{'PERL_CORE'}){
7 unshift @INC, '../lib';
10 if (! $Config{'useithreads'}) {
11 print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
16 use ExtUtils::testlib;
21 if (! eval 'use threads::shared; 1') {
22 print("1..0 # SKIP threads::shared not available\n");
27 print("1..6\n"); ### Number of tests that will be run ###
44 # You have to do it this way or VMS will get confused.
46 print("ok $id - $name\n");
48 print("not ok $id - $name\n");
49 printf("# Failed test at line %d\n", (caller)[2]);
56 ### Start of Testing ###
58 # Test that END blocks are run in the thread that created them,
59 # and not in any child threads.
62 ok(1, 'Main END block')
65 threads->create(sub { eval "END { ok(1, '1st thread END block') }"})->join();
66 threads->create(sub { eval "END { ok(1, '2nd thread END block') }"})->join();
69 eval "END { ok(1, '4th thread END block') }";
70 threads->create(sub { eval "END { ok(1, '5th thread END block') }"})->join();
72 threads->create(\&thread)->join();