Commit | Line | Data |
da46a8d0 |
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 | use threads; |
15 | use threads::shared; |
16 | use Test::More tests => 4; |
17 | |
18 | |
19 | # |
20 | # This tests for too much destruction |
21 | # which was caused by cloning stashes |
22 | # on join which led to double the dataspace |
23 | # |
24 | ######################### |
25 | |
26 | $|++; |
27 | use Devel::Peek; |
28 | |
29 | |
30 | { |
31 | |
32 | sub Foo::DESTROY { |
33 | my $self = shift; |
34 | my ($package, $file, $line) = caller; |
35 | is(threads->tid(),$self->{tid}, "In destroy it should be correct too" ) |
36 | } |
37 | my $foo; |
38 | $foo = bless {tid => 0}, 'Foo'; |
39 | my $bar = threads->create(sub { |
40 | is(threads->tid(),1, "And tid be 10 here"); |
41 | $foo->{tid} = 1; |
42 | return $foo; |
43 | })->join(); |
44 | $bar->{tid} = 0; |
45 | |
46 | |
47 | } |
48 | 1; |
49 | |
50 | |
51 | |
52 | |
53 | |
54 | |
55 | |