summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MANIFEST1
-rw-r--r--ext/threads/shared/t/hv_refs.t44
2 files changed, 45 insertions, 0 deletions
diff --git a/MANIFEST b/MANIFEST
index e0b0ab8db2..2e3e9af229 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -588,6 +588,7 @@ ext/threads/shared/t/sv_simple.t thread shared variables
ext/threads/shared/t/sv_refs.t thread shared variables
ext/threads/shared/t/av_simple.t Tests for basic shared array functionality.
ext/threads/shared/t/hv_simple.t Tests for basic shared hash functionality.
+ext/threads/shared/t/hv_refs.t Test shared hashes containing references
ext/Time/HiRes/Changes Time::HiRes extension
ext/Time/HiRes/hints/dynixptx.pl Hint for Time::HiRes for named architecture
ext/Time/HiRes/hints/sco.pl Hints for Time::HiRes for named architecture
diff --git a/ext/threads/shared/t/hv_refs.t b/ext/threads/shared/t/hv_refs.t
new file mode 100644
index 0000000000..53029bfcd5
--- /dev/null
+++ b/ext/threads/shared/t/hv_refs.t
@@ -0,0 +1,44 @@
+BEGIN {
+# chdir 't' if -d 't';
+# push @INC ,'../lib';
+ require Config; import Config;
+ unless ($Config{'useithreads'}) {
+ print "1..0 # Skip: no useithreads\n";
+ exit 0;
+ }
+}
+
+
+sub ok {
+ my ($id, $ok, $name) = @_;
+
+ # You have to do it this way or VMS will get confused.
+ print $ok ? "ok $id - $name\n" : "not ok $id - $name\n";
+
+ printf "# Failed test at line %d\n", (caller)[2] unless $ok;
+
+ return $ok;
+}
+
+
+
+use ExtUtils::testlib;
+use strict;
+BEGIN { print "1..7\n" };
+use threads;
+use threads::shared;
+ok(1,1,"loaded");
+my $foo;
+share($foo);
+my %foo;
+share(%foo);
+$foo{"foo"} = \$foo;
+ok(2, ${$foo{foo}} == undef, "Check deref");
+$foo = "test";
+ok(3, ${$foo{foo}} eq "test", "Check deref after assign");
+threads->create(sub{${$foo{foo}} = "test2";})->join();
+ok(4, $foo eq "test2", "Check after assign in another thread");
+ok(5, threads::shared::_thrcnt($foo) == 2, "Check refcount");
+my $bar = delete($foo{foo});
+ok(6, $$bar eq "test2", "check delete");
+ok(7, threads::shared::_thrcnt($foo) == 1, "Check refcount after delete");