BEGIN {
chdir 't' if -d 't';
- @INC = qw(../lib .);
+ push @INC, '../lib','.';
require Config; import Config;
unless ($Config{'useithreads'}) {
print "1..0 # Skip: no useithreads\n";
use ExtUtils::testlib;
use strict;
-BEGIN { $| = 1; print "1..21\n" };
+BEGIN { $| = 1; print "1..25\n" };
use threads;
use threads::shared;
ok($thr6->join());
ok($thr7->join());
}
+
+# test that 'yield' is importable
+
+package Test1;
+
+use threads 'yield';
+yield;
+main::ok(1);
+
+package main;
+
+
+# test async
+
+{
+ my $th = async {return 1 };
+ ok($th);
+ ok($th->join());
+}
+{
+ # there is a little chance this test case will falsly fail
+ # since it tests rand
+ my %rand : shared;
+ rand(10);
+ threads->new( sub { $rand{int(rand(10000000000))}++ } ) foreach 1..25;
+ $_->join foreach threads->list;
+# use Data::Dumper qw(Dumper);
+# print Dumper(\%rand);
+ #$val = rand();
+ ok((keys %rand == 25), "Check that rand works after a new thread");
+}
+
+
+