X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FLinux-SysInfo.git;a=blobdiff_plain;f=t%2F30-threads.t;fp=t%2F30-threads.t;h=cd4c3a617861242968c7e82bce6866e93c81720f;hp=690bd1167658ba44bab73296acbbeb628ef1a0f4;hb=bea1d11f74a387b85e2daa0a684466ed65d7ea71;hpb=df2d2239c4e52ed9bf6891f03d6a3bb8e65a1297 diff --git a/t/30-threads.t b/t/30-threads.t index 690bd11..cd4c3a6 100644 --- a/t/30-threads.t +++ b/t/30-threads.t @@ -3,22 +3,10 @@ use strict; use warnings; -use Config qw<%Config>; - -BEGIN { - my $has_threads = do { - local $@; - $Config{useithreads} and eval "use threads; 1"; - }; - # Load Test::More after threads - require Test::More; - Test::More->import; - if ($has_threads) { - plan(tests => 4 * 10); - } else { - plan(skip_all => 'This perl wasn\'t built to support threads'); - } -} +use lib 't/lib'; +use Linux::SysInfo::TestThreads; + +use Test::More 'no_plan'; use Linux::SysInfo qw; @@ -40,5 +28,8 @@ sub try { } } -my @t = map { threads->create(\&try, $_) } 1 .. 10; -$_->join for @t; +my @threads = map spawn(\&try, $_), 1 .. 10; + +$_->join for @threads; + +pass 'done';