make broken threads warning more explicit
[p5sagit/Devel-GlobalDestruction.git] / t / 02_thread.t
1 use t::threads_check;
2
3 use threads;
4 use threads::shared;
5
6 our $had_error :shared;
7 END { $? = $had_error||0 }
8
9 use strict;
10 use warnings;
11
12 BEGIN {
13   if ($ENV{DEVEL_GLOBALDESTRUCTION_PP_TEST}) {
14     unshift @INC, sub {
15       die 'no XS' if $_[1] eq 'Devel/GlobalDestruction/XS.pm';
16     };
17   }
18 }
19
20 # load it before spawning a thread, that's the whole point
21 require Devel::GlobalDestruction;
22
23 sub do_test {
24
25   # just die so we don't need to deal with testcount skew
26   unless ( ($_[0]||'') eq 'arg' ) {
27     $had_error++;
28     die "Argument passing failed!";
29   }
30
31   delete $INC{'t/01_basic.t'};
32   do 't/01_basic.t';
33
34   1;
35 }
36
37 threads->create('do_test', 'arg')->join
38   or $had_error++;