summaryrefslogtreecommitdiff
path: root/ext/threads/shared/t/no_share.t
diff options
context:
space:
mode:
authorAndy Bussey <andybussey@yahoo.co.uk>2002-01-03 00:46:58 +0000
committerAbhijit Menon-Sen <ams@wiw.org>2002-01-02 23:56:37 +0000
commitdab065ea9c8b629eb22b219d57901aa33df76f4f (patch)
treec6ac2ab90d31f9900568b1b23b14f881ca0c3a9f /ext/threads/shared/t/no_share.t
parent94bdecf9800c3bee967274854f7adf2933ffd42b (diff)
downloadperl-dab065ea9c8b629eb22b219d57901aa33df76f4f.tar.gz
threads::shared disabling
Message-Id: <20020103004658.97969.qmail@web21006.mail.yahoo.com> p4raw-link: @14015 on //depot/perl: 38b0d3dc02713f3c8313d8d82d06f680810942d4 p4raw-id: //depot/perl@14030
Diffstat (limited to 'ext/threads/shared/t/no_share.t')
-rw-r--r--ext/threads/shared/t/no_share.t47
1 files changed, 47 insertions, 0 deletions
diff --git a/ext/threads/shared/t/no_share.t b/ext/threads/shared/t/no_share.t
new file mode 100644
index 0000000000..519d9cb532
--- /dev/null
+++ b/ext/threads/shared/t/no_share.t
@@ -0,0 +1,47 @@
+
+
+
+
+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;
+ }
+ $SIG{__WARN__} = sub { $warnmsg = shift; };
+}
+
+
+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;
+}
+
+our $warnmsg;
+use ExtUtils::testlib;
+use strict;
+BEGIN { print "1..5\n" };
+use threads::shared;
+use threads;
+ok(1,1,"loaded");
+ok(2,$warnmsg =~ /Warning, threads::shared has already been loaded/,
+ "threads has warned us");
+my $test = "bar";
+share($test);
+ok(3,$test eq "bar","Test disabled share not interfering");
+threads->create(
+ sub {
+ ok(4,$test eq "bar","Test disabled share after thread");
+ $test = "baz";
+ })->join();
+ok(5,$test eq "bar","Test that value hasn't changed in another thread");
+
+