X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FThread-Cleanup.git;a=blobdiff_plain;f=t%2F21-ctl.t;fp=t%2F21-ctl.t;h=b2236d37db4cc3dd93fd111a949b5dcb01933680;hp=1d689cb7551d431c4ae6d58d3a87f231384b427c;hb=981090d572d766fbcccf048b3777e6fd1edc4fea;hpb=86915a65eed5d806e6c48b8b8fda1d3c4d990987 diff --git a/t/21-ctl.t b/t/21-ctl.t index 1d689cb..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';