4 require Config; import Config;
5 unless ($Config{'useithreads'}) {
6 print "1..0 # Skip: no useithreads\n";
13 my ($id, $ok, $name) = @_;
15 # You have to do it this way or VMS will get confused.
16 print $ok ? "ok $id - $name\n" : "not ok $id - $name\n";
18 printf "# Failed test at line %d\n", (caller)[2] unless $ok;
25 use ExtUtils::testlib;
27 BEGIN { print "1..7\n" };
36 ok(2, ${$foo{foo}} == undef, "Check deref");
38 ok(3, ${$foo{foo}} eq "test", "Check deref after assign");
39 threads->create(sub{${$foo{foo}} = "test2";})->join();
40 ok(4, $foo eq "test2", "Check after assign in another thread");
41 ok(5, threads::shared::_thrcnt($foo) == 2, "Check refcount");
42 my $bar = delete($foo{foo});
43 ok(6, $$bar eq "test2", "check delete");
44 ok(7, threads::shared::_thrcnt($foo) == 1, "Check refcount after delete");