8 require Config; import Config;
9 unless ($Config{'useithreads'}) {
10 print "1..0 # Skip: no useithreads\n";
17 my ($id, $ok, $name) = @_;
19 # You have to do it this way or VMS will get confused.
20 print $ok ? "ok $id - $name\n" : "not ok $id - $name\n";
22 printf "# Failed test at line %d\n", (caller)[2] unless $ok;
28 use ExtUtils::testlib;
30 BEGIN { print "1..10\n" };
36 ok(2,$test eq "bar","Test magic share fetch");
38 ok(3,$test eq "foo","Test magic share assign");
39 my $c = threads::shared::_refcnt($test);
42 ok(4, $test eq "foo","Test magic share fetch after thread");
44 ok(5,threads::shared::_refcnt($test) > $c, "Check that threadcount is correct");
46 ok(6,$test eq "baz","Test that value has changed in another thread");
47 ok(7,threads::shared::_refcnt($test) == $c,"Check thrcnt is down properly");
49 ok(8, length($test) == 6, "Check length code");
50 threads->create(sub { $test = "barbarbar" })->join;
51 ok(9, length($test) == 9, "Check length code after different thread modified it");
52 threads->create(sub { undef($test)})->join();
53 ok(10, !defined($test), "Check undef value");