3 # Tests if $$ and getppid return consistent values across threads
15 if (!$Config{useithreads}) {
16 print "1..0 # Skip: no ithreads\n";
19 if (!$Config{d_getppid}) {
20 print "1..0 # Skip: no getppid\n";
23 eval 'use threads; use threads::shared';
24 if ($@ =~ /dynamic loading not available/) {
25 print "1..0 # Skip: no dynamic loading, no threads\n";
30 fail("unable to load thread modules");
33 pass("thread modules loaded");
37 my ($pid, $ppid) = ($$, getppid());
38 my $pid2 : shared = 0;
39 my $ppid2 : shared = 0;
41 new threads( sub { ($pid2, $ppid2) = ($$, getppid()); } ) -> join();
43 is($pid, $pid2, 'pids');
44 is($ppid, $ppid2, 'ppids');