diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 2002-08-30 08:06:56 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 2002-08-30 08:06:56 +0000 |
commit | e87ef8c0197c05592a0b7988f7f1af2f39f06465 (patch) | |
tree | 098b319dd8e68660910e5c2b0a52cdd0bc4a5ca7 /t/op/getpid.t | |
parent | 54f3bd6bfff108b3d388b542cab121e33bfdea6a (diff) | |
parent | cfc8a8024406f6fb9714bbb00f3199af53485a87 (diff) | |
download | perl-e87ef8c0197c05592a0b7988f7f1af2f39f06465.tar.gz |
Integrate mainline
p4raw-id: //depot/perlio@17809
Diffstat (limited to 't/op/getpid.t')
-rw-r--r-- | t/op/getpid.t | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/t/op/getpid.t b/t/op/getpid.t new file mode 100644 index 0000000000..dd06f006a6 --- /dev/null +++ b/t/op/getpid.t @@ -0,0 +1,35 @@ +#!perl -w + +# Tests if $$ and getppid return consistent values across threads + +BEGIN { + chdir 't' if -d 't'; + @INC = qw(../lib); +} + +use strict; +use Config; + +BEGIN { + if (!$Config{useithreads}) { + print "1..0 # Skip: no ithreads\n"; + exit; + } + if (!$Config{d_getppid}) { + print "1..0 # Skip: no getppid\n"; + exit; + } +} + +use threads; +use threads::shared; + +my ($pid, $ppid) = ($$, getppid()); +my $pid2 : shared = 0; +my $ppid2 : shared = 0; + +new threads( sub { ($pid2, $ppid2) = ($$, getppid()); } ) -> join(); + +print "1..2\n"; +print "not " if $pid != $pid2; print "ok 1 - pids\n"; +print "not " if $ppid != $ppid2; print "ok 2 - ppids\n"; |