9 if (! $Config{usethreads}) {
10 print("1..0 # Skip: No threads\n");
15 use Thread qw(:DEFAULT async yield);
17 use Test::More tests => 13;
22 if ($threads::shared::threads_shared) {
23 &threads::shared::share(\$lock);
33 my $self = Thread->self;
41 $thr = Thread->new(\&thr_sub);
43 isa_ok($thr, 'Thread');
45 ok(! $thr->done(), 'Thread running');
46 is($thr->tid, 1, "thread's tid");
48 my ($thr2) = Thread->list;
49 ok($thr2->equal($thr), '->list returned thread');
54 ok($thr->done(), 'Thread done');
55 is($thr->join(), 1, "->join returned thread's tid");
60 my $thr = async { Thread->self->tid; };
61 isa_ok($thr, 'Thread');
62 is($thr->tid, 2, "async thread's tid");
63 is($thr->join, 2, "->join on async returned tid");
72 return Thread->self->tid;
78 $thr = Thread->new(\&thr_wait);
79 isa_ok($thr, 'Thread');
80 ok(! $thr->done(), 'Thread running');
92 ok($thr->done(), 'Thread done');
93 is($thr->join(), 3, "->join returned thread's tid");