summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-11-30 22:16:51 +0200
committerH.Merijn Brand <h.m.brand@xs4all.nl>2002-12-02 15:43:16 +0000
commite297595301ee5f3b0643be0fb1fffae9b6b548a0 (patch)
tree180f2d7e6d134e4213582d3b546ed42908da3da8 /ext
parent1a67fee7d910c67790fff4a69f2f20f7628aa80a (diff)
downloadperl-e297595301ee5f3b0643be0fb1fffae9b6b548a0.tar.gz
$0 mofifying part I
Subject: [PATCH] $0 modifying Message-ID: <20021130181651.GA5876@kosh.hut.fi> p4raw-id: //depot/perl@18229
Diffstat (limited to 'ext')
-rw-r--r--ext/threads/t/join.t29
1 files changed, 28 insertions, 1 deletions
diff --git a/ext/threads/t/join.t b/ext/threads/t/join.t
index f2c88d524b..892f48d055 100644
--- a/ext/threads/t/join.t
+++ b/ext/threads/t/join.t
@@ -11,7 +11,7 @@ BEGIN {
use ExtUtils::testlib;
use strict;
-BEGIN { print "1..10\n" };
+BEGIN { print "1..11\n" };
use threads;
use threads::shared;
@@ -87,3 +87,30 @@ ok(1,"");
})->join();
ok(1,"");
}
+
+if ($^O eq 'linux') { # We parse ps output so this is OS-dependent.
+
+ # First modify $0 in a subthread.
+ print "# 1a: \$0 = $0\n";
+ join( threads->new( sub {
+ print "# 2a: \$0 = $0\n";
+ $0 = "foobar";
+ print "# 2b: \$0 = $0\n" } ) );
+ print "# 1b: \$0 = $0\n";
+ if (open PS, "ps -f |") {
+ my $ok;
+ while (<PS>) {
+ print "# $_";
+ if (/^\S+\s+$$\s.+\sfoobar\s*$/) {
+ $ok++;
+ last;
+ }
+ }
+ close PS;
+ ok($ok, 'altering $0 is effective');
+ } else {
+ skip("\$0 check: opening 'ps -f |' failed: $!");
+ }
+} else {
+ skip("\$0 check: only on Linux");
+}