Skip to content

Commit fede9e6

Browse files
author
Jerry D. Hedden
authored
Merge pull request #7 from Dual-Life/develop
1.59 Prevent XSLoader call on non-threaded Perl
2 parents a2fa09f + 65ad9be commit fede9e6

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

Changes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ Revision history for Perl extension threads::shared.
33
-
44
-
55

6+
1.59 Wed Nov 28 03:53:14 2018
7+
- Prevent XSLoader call on non-threaded Perl
8+
69
1.58 Mon Jan 22 20:09:07 EST 2018
710
- Fix CLANG macros.
811
- Sync with blead.

README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
threads::shared version 1.58
1+
threads::shared version 1.59
22
============================
33

44
This module needs Perl 5.8.0 or later compiled with USEITHREADS.

lib/threads/shared.pm

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ use 5.008;
44

55
use strict;
66
use warnings;
7+
use Config;
78

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

10-
our $VERSION = '1.58'; # Please update the pod, too.
11+
our $VERSION = '1.59'; # Please update the pod, too.
1112
my $XS_VERSION = $VERSION;
1213
$VERSION = eval $VERSION;
1314

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

2021
# Load the XS code, if applicable
21-
if ($threads::threads) {
22+
if ($Config::Config{'useithreads'} && $threads::threads) {
2223
require XSLoader;
2324
XSLoader::load('threads::shared', $XS_VERSION);
2425

@@ -195,7 +196,7 @@ threads::shared - Perl extension for sharing data structures between threads
195196
196197
=head1 VERSION
197198
198-
This document describes threads::shared version 1.58
199+
This document describes threads::shared version 1.59
199200
200201
=head1 SYNOPSIS
201202

t/test.pl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
# In this file, we use the latter "Baby Perl" approach, and increment
2020
# will be worked over by t/op/inc.t
2121

22+
$| = 1;
2223
$Level = 1;
2324
my $test = 1;
2425
my $planned;
@@ -1746,4 +1747,18 @@ ($;$)
17461747
}
17471748
}
17481749

1750+
# Orphaned Docker or Linux containers do not necessarily attach to PID 1. They might attach to 0 instead.
1751+
sub is_linux_container {
1752+
1753+
if ($^O eq 'linux' && open my $fh, '<', '/proc/1/cgroup') {
1754+
while(<$fh>) {
1755+
if (m{^\d+:pids:(.*)} && $1 ne '/init.scope') {
1756+
return 1;
1757+
}
1758+
}
1759+
}
1760+
1761+
return 0;
1762+
}
1763+
17491764
1;

0 commit comments

Comments
 (0)