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;
22 require threads::shared;
23 import threads::shared;
25 if ($@ || ! $threads::shared::threads_shared) {
26 print("1..0 # Skip: threads::shared not available\n");
31 print("1..6\n"); ### Number of tests that will be run ###
48 # You have to do it this way or VMS will get confused.
50 print("ok $id - $name\n");
52 print("not ok $id - $name\n");
53 printf("# Failed test at line %d\n", (caller)[2]);
60 ### Start of Testing ###
62 # Test that END blocks are run in the thread that created them,
63 # and not in any child threads.
66 ok(1, 'Main END block')
69 threads->create(sub { eval "END { ok(1, '1st thread END block') }"})->join();
70 threads->create(sub { eval "END { ok(1, '2nd thread END block') }"})->join();
73 eval "END { ok(1, '4th thread END block') }";
74 threads->create(sub { eval "END { ok(1, '5th thread END block') }"})->join();
76 threads->create(\&thread)->join();