]> git.vpit.fr Git - perl/modules/Linux-SysInfo.git/blobdiff - t/30-threads.t
This is 0.15
[perl/modules/Linux-SysInfo.git] / t / 30-threads.t
index b7318c72195bf28bad08d924bfbbe30628039d35..cd4c3a617861242968c7e82bce6866e93c81720f 100644 (file)
@@ -3,24 +3,12 @@
 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/sysinfo/;
+use Linux::SysInfo qw<sysinfo>;
 
 sub try {
  my $tid = threads->tid();
@@ -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';