cope better with broken threads
[p5sagit/Devel-GlobalDestruction.git] / t / 02_thread.t
CommitLineData
1035e7c4 1use t::threads_check;
844f2408 2
3use threads;
5197ed54 4use threads::shared;
5
6our $had_error :shared;
7END { $? = $had_error||0 }
8
844f2408 9use strict;
5197ed54 10use warnings;
844f2408 11
9aaf3646 12BEGIN {
53daa838 13 if ($ENV{DEVEL_GLOBALDESTRUCTION_PP_TEST}) {
b1bee216 14 unshift @INC, sub {
15 die 'no XS' if $_[1] eq 'Devel/GlobalDestruction/XS.pm';
16 };
53daa838 17 }
9aaf3646 18}
19
5197ed54 20# load it before spawning a thread, that's the whole point
21require Devel::GlobalDestruction;
22
23sub 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}
844f2408 36
5197ed54 37threads->create('do_test', 'arg')->join
38 or $had_error++;