Commit | Line | Data |
4e00007d |
1 | |
2 | BEGIN { |
3 | chdir 't' if -d 't'; |
4 | @INC = '../lib'; |
5 | require Config; import Config; |
6 | unless ($Config{'useithreads'}) { |
7 | print "1..0 # Skip: no useithreads\n"; |
8 | exit 0; |
9 | } |
10 | } |
11 | |
12 | use ExtUtils::testlib; |
13 | use strict; |
14 | BEGIN { print "1..6\n" }; |
15 | use threads; |
16 | use threads::shared; |
17 | |
18 | my $test_id = 1; |
19 | share($test_id); |
20 | use Devel::Peek qw(Dump); |
21 | |
22 | sub ok { |
23 | my ($ok, $name) = @_; |
24 | |
25 | # You have to do it this way or VMS will get confused. |
26 | print $ok ? "ok $test_id - $name\n" : "not ok $test_id - $name\n"; |
27 | |
28 | printf "# Failed test at line %d\n", (caller)[2] unless $ok; |
29 | $test_id++; |
30 | return $ok; |
31 | } |
32 | ok(1); |
33 | END { ok(1,"End block run once") } |
34 | threads->create(sub { eval "END { ok(1,'') }"})->join(); |
35 | threads->create(sub { eval "END { ok(1,'') }"})->join(); |
36 | threads->create(\&thread)->join(); |
37 | |
38 | sub thread { |
39 | eval "END { ok(1,'') }"; |
40 | threads->create(sub { eval "END { ok(1,'') }"})->join(); |
41 | } |