summaryrefslogtreecommitdiff
path: root/t/op
diff options
context:
space:
mode:
Diffstat (limited to 't/op')
-rw-r--r--t/op/getpid.t15
1 files changed, 13 insertions, 2 deletions
diff --git a/t/op/getpid.t b/t/op/getpid.t
index 7c1c04264b..7688240182 100644
--- a/t/op/getpid.t
+++ b/t/op/getpid.t
@@ -30,5 +30,16 @@ my $ppid2 : shared = 0;
new threads( sub { ($pid2, $ppid2) = ($$, getppid()); } ) -> join();
-is($pid, $pid2, 'pids');
-is($ppid, $ppid2, 'ppids');
+# If this breaks you're either running under LinuxThreads (and we
+# haven't detected it) or your system doesn't have POSIX thread
+# semantics.
+if ($^O =~ /^(?:gnukfreebsd|linux)$/ and
+ (my $linuxthreads = qx[getconf GNU_LIBPTHREAD_VERSION 2>&1]) =~ /linuxthreads/) {
+ chomp $linuxthreads;
+ diag "We're running under $^O with linuxthreads <$linuxthreads>";
+ isnt($pid, $pid2, "getpid() in a thread is different from the parent on this non-POSIX system");
+ isnt($ppid, $ppid2, "getppid() in a thread is different from the parent on this non-POSIX system");
+} else {
+ is($pid, $pid2, 'getpid() in a thread is the same as in the parent');
+ is($ppid, $ppid2, 'getppid() in a thread is the same as in the parent');
+}