X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F21-ctl.t;h=b2236d37db4cc3dd93fd111a949b5dcb01933680;hb=HEAD;hp=4029b90c5c25ebf4d974b5d39efb25f7efb7e251;hpb=f178c1e569b78464ea63bf184389cf1b00804690;p=perl%2Fmodules%2FThread-Cleanup.git diff --git a/t/21-ctl.t b/t/21-ctl.t index 4029b90..b2236d3 100644 --- a/t/21-ctl.t +++ b/t/21-ctl.t @@ -3,25 +3,10 @@ use strict; use warnings; -use Config qw/%Config/; +use lib 't/lib'; +use Thread::Cleanup::TestThreads; -BEGIN { - if (!$Config{useithreads}) { - require Test::More; - Test::More->import; - plan(skip_all => 'This perl wasn\'t built to support threads'); - } -} - -use threads; -use threads::shared; - -use Test::More tests => 5 + 1; - -BEGIN { - defined and diag "Using threads $_" for $threads::VERSION; - defined and diag "Using threads::shared $_" for $threads::shared::VERSION; -} +use Test::More; use Thread::Cleanup; @@ -38,11 +23,17 @@ Thread::Cleanup::register { { local $SIG{__DIE__} = sub { msg 'sig', @_ }; no warnings 'threads'; - threads->create(sub { + my $thr = spawn(sub { msg 'spawn'; die 'thread'; msg 'not reached 2'; - })->join; + }); + if ($thr) { + plan tests => 5 + 1; + } else { + plan skip_all => 'Could not spawn the testing thread'; + } + $thr->join; } msg 'done';