Skip to content

Commit

Permalink
Merge pull request #7 from Dual-Life/develop
Browse files Browse the repository at this point in the history
1.59 Prevent XSLoader call on non-threaded Perl
  • Loading branch information
jdhedden authored Nov 30, 2018
2 parents a2fa09f + 65ad9be commit fede9e6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Revision history for Perl extension threads::shared.
-
-

1.59 Wed Nov 28 03:53:14 2018
- Prevent XSLoader call on non-threaded Perl

1.58 Mon Jan 22 20:09:07 EST 2018
- Fix CLANG macros.
- Sync with blead.
Expand Down
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
threads::shared version 1.58
threads::shared version 1.59
============================

This module needs Perl 5.8.0 or later compiled with USEITHREADS.
Expand Down
7 changes: 4 additions & 3 deletions lib/threads/shared.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ use 5.008;

use strict;
use warnings;
use Config;

use Scalar::Util qw(reftype refaddr blessed);

our $VERSION = '1.58'; # Please update the pod, too.
our $VERSION = '1.59'; # Please update the pod, too.
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;

Expand All @@ -18,7 +19,7 @@ $threads::shared::threads_shared = 1;
$threads::shared::clone_warn = undef;

# Load the XS code, if applicable
if ($threads::threads) {
if ($Config::Config{'useithreads'} && $threads::threads) {
require XSLoader;
XSLoader::load('threads::shared', $XS_VERSION);

Expand Down Expand Up @@ -195,7 +196,7 @@ threads::shared - Perl extension for sharing data structures between threads
=head1 VERSION
This document describes threads::shared version 1.58
This document describes threads::shared version 1.59
=head1 SYNOPSIS
Expand Down
15 changes: 15 additions & 0 deletions t/test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# In this file, we use the latter "Baby Perl" approach, and increment
# will be worked over by t/op/inc.t

$| = 1;
$Level = 1;
my $test = 1;
my $planned;
Expand Down Expand Up @@ -1746,4 +1747,18 @@ ($;$)
}
}

# Orphaned Docker or Linux containers do not necessarily attach to PID 1. They might attach to 0 instead.
sub is_linux_container {

if ($^O eq 'linux' && open my $fh, '<', '/proc/1/cgroup') {
while(<$fh>) {
if (m{^\d+:pids:(.*)} && $1 ne '/init.scope') {
return 1;
}
}
}

return 0;
}

1;

0 comments on commit fede9e6

Please sign in to comment.