5 require Config; import Config;
6 unless ($Config{'useithreads'}) {
7 print "1..0 # Skip: no useithreads\n";
12 use ExtUtils::testlib;
17 BEGIN { $| = 1; print "1..8\n" };
25 #########################
27 my ($id, $ok, $name) = @_;
29 # You have to do it this way or VMS will get confused.
30 print $ok ? "ok $id - $name\n" : "not ok $id - $name\n";
32 printf "# Failed test at line %d\n", (caller)[2] unless $ok;
37 ok(2, scalar @{[threads->list]} == 0,'');
41 threads->create(sub {})->join();
42 ok(3, scalar @{[threads->list]} == 0,'');
44 my $thread = threads->create(sub {});
45 ok(4, scalar @{[threads->list]} == 1,'');
47 ok(5, scalar @{[threads->list]} == 0,'');
49 $thread = threads->create(sub { ok(6, threads->self == (threads->list)[0],'')});
50 threads->yield; # help out non-preemptive thread implementations
52 ok(7, $thread == (threads->list)[0],'');
54 ok(8, scalar @{[threads->list]} == 0,'');