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;
38 ok(2, threads->self == (threads->list)[0]);
41 threads->create(sub {})->join();
42 ok(3, scalar @{[threads->list]} == 1);
44 my $thread = threads->create(sub {});
45 ok(4, scalar @{[threads->list]} == 2);
47 ok(5, scalar @{[threads->list]} == 1);
49 $thread = threads->create(sub { ok(6, threads->self == (threads->list)[1])});
51 ok(7, $thread == (threads->list)[1]);
53 ok(8, scalar @{[threads->list]} == 1);