New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] Upgrade to threads::shared 1.56 #15973
Comments
From @jdheddenThis is a bug report for perl from jdhedden@cpan.org, The attached patch upgrades 'threads::shared' to version 1.56. It fixes compatibility issues with Clang macros for Perl <5.24 per No functional changes to module. Flags: Site configuration information for perl 5.24.1: Configured by Debian Project at Thu Mar 16 11:11:46 UTC 2017. Summary of my perl5 (revision 5 version 24 subversion 1) configuration: Locally applied patches: @INC for perl 5.24.1: Environment for perl 5.24.1: |
From @jdhedden0001-Upgrade-to-threads-shared-1.56.patchFrom 9843fe9886bf59520e9b077b17dec200011dfe6e Mon Sep 17 00:00:00 2001
From: jdhedden <jdhedden@cpan.org>
Date: Sun, 7 May 2017 18:38:43 -0400
Subject: [PATCH] Upgrade to threads::shared 1.56
---
Porting/Maintainers.pl | 2 +-
dist/threads-shared/shared.xs | 11 +++++------
dist/threads-shared/t/object2.t | 24 +-----------------------
3 files changed, 7 insertions(+), 30 deletions(-)
diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl
index e9032a91f3..f9a87a8eb5 100755
--- a/Porting/Maintainers.pl
+++ b/Porting/Maintainers.pl
@@ -1173,7 +1173,7 @@ use File::Glob qw(:case);
},
'threads::shared' => {
- 'DISTRIBUTION' => 'JDHEDDEN/threads-shared-1.55.tar.gz',
+ 'DISTRIBUTION' => 'JDHEDDEN/threads-shared-1.56.tar.gz',
'FILES' => q[dist/threads-shared],
'EXCLUDED' => [
qw( examples/class.pl
diff --git a/dist/threads-shared/shared.xs b/dist/threads-shared/shared.xs
index 3c1b5e608c..89a59d43ce 100644
--- a/dist/threads-shared/shared.xs
+++ b/dist/threads-shared/shared.xs
@@ -656,14 +656,15 @@ Perl_sharedsv_cond_timedwait(perl_cond *cond, perl_mutex *mut, double abs)
abs -= (NV)ts.tv_sec;
ts.tv_nsec = (long)(abs * 1000000000.0);
-#if defined(__clang__) || defined(__clang)
+#if defined(CLANG_DIAG_IGNORE)
CLANG_DIAG_IGNORE(-Wthread-safety);
/* warning: calling function 'pthread_cond_timedwait' requires holding mutex 'mut' exclusively [-Wthread-safety-analysis] */
#endif
switch (pthread_cond_timedwait(cond, mut, &ts)) {
-#if defined(__clang__) || defined(__clang)
+/* perl.h defines CLANG_DIAG_* but only in 5.24+ */
+#if defined(CLANG_DIAG_RESTORE)
CLANG_DIAG_RESTORE;
#endif
@@ -1104,9 +1105,8 @@ sharedsv_array_mg_CLEAR(pTHX_ SV *sv, MAGIC *mg)
if (!sv) continue;
if ( (SvOBJECT(sv) || (SvROK(sv) && (sv = SvRV(sv))))
&& SvREFCNT(sv) == 1 ) {
- SV *tmp;
+ SV *tmp = Perl_sv_newmortal(caller_perl);
PERL_SET_CONTEXT((aTHX = caller_perl));
- tmp = sv_newmortal();
sv_upgrade(tmp, SVt_RV);
get_RV(tmp, sv);
PERL_SET_CONTEXT((aTHX = PL_sharedsv_space));
@@ -1385,9 +1385,8 @@ STORESIZE(SV *obj,IV count)
if ( (SvOBJECT(sv) || (SvROK(sv) && (sv = SvRV(sv))))
&& SvREFCNT(sv) == 1 )
{
- SV *tmp;
+ SV *tmp = Perl_sv_newmortal(caller_perl);
PERL_SET_CONTEXT((aTHX = caller_perl));
- tmp = sv_newmortal();
sv_upgrade(tmp, SVt_RV);
get_RV(tmp, sv);
PERL_SET_CONTEXT((aTHX = PL_sharedsv_space));
diff --git a/dist/threads-shared/t/object2.t b/dist/threads-shared/t/object2.t
index 31c3797431..3d795b9208 100644
--- a/dist/threads-shared/t/object2.t
+++ b/dist/threads-shared/t/object2.t
@@ -17,7 +17,7 @@ use ExtUtils::testlib;
BEGIN {
$| = 1;
- print("1..133\n"); ### Number of tests that will be run ###
+ print("1..131\n"); ### Number of tests that will be run ###
};
use threads;
@@ -445,28 +445,6 @@ ok($destroyed[$ID], 'Scalar object removed from shared scalar');
::ok($count == $n, "remove array object by undef");
}
-# RT #131124
-# Emptying a shared array creates new temp SVs. If there are no spare
-# SVs, a new arena is allocated. shared.xs was mallocing a new arena
-# with the wrong perl context set, meaning that when the arena was later
-# freed, it would "panic: realloc from wrong pool"
-#
-
-{
- threads->new(sub {
- my @a :shared;
- push @a, bless &threads::shared::share({}) for 1..1000;
- undef @a; # this creates lots of temp SVs
- })->join;
- ok(1, "#131124 undef array doesnt panic");
-
- threads->new(sub {
- my @a :shared;
- push @a, bless &threads::shared::share({}) for 1..1000;
- @a = (); # this creates lots of temp SVs
- })->join;
- ok(1, "#131124 clear array doesnt panic");
-}
# EOF
--
2.11.0
|
From @jdheddenInitial patch missed changes made in blead only by Dave Mitchell. This revised patch is correct with appropriate version bump. On Sun, 07 May 2017 15:39:33 -0700, jdhedden@cpan.org wrote:
|
From @jdhedden0001-Upgrade-to-threads-shared-1.57.patchFrom 27e7b9090e155e33627a1c750d6763b1faa013c0 Mon Sep 17 00:00:00 2001
From: jdhedden <jdhedden@cpan.org>
Date: Sun, 7 May 2017 18:48:59 -0400
Subject: [PATCH] Upgrade to threads::shared 1.57
---
Porting/Maintainers.pl | 2 +-
dist/threads-shared/lib/threads/shared.pm | 4 ++--
dist/threads-shared/shared.xs | 5 +++--
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl
index e9032a91f3..aeb98604fd 100755
--- a/Porting/Maintainers.pl
+++ b/Porting/Maintainers.pl
@@ -1173,7 +1173,7 @@ use File::Glob qw(:case);
},
'threads::shared' => {
- 'DISTRIBUTION' => 'JDHEDDEN/threads-shared-1.55.tar.gz',
+ 'DISTRIBUTION' => 'JDHEDDEN/threads-shared-1.57.tar.gz',
'FILES' => q[dist/threads-shared],
'EXCLUDED' => [
qw( examples/class.pl
diff --git a/dist/threads-shared/lib/threads/shared.pm b/dist/threads-shared/lib/threads/shared.pm
index 73c4dd997f..9be89f33f2 100644
--- a/dist/threads-shared/lib/threads/shared.pm
+++ b/dist/threads-shared/lib/threads/shared.pm
@@ -7,7 +7,7 @@ use warnings;
use Scalar::Util qw(reftype refaddr blessed);
-our $VERSION = '1.56'; # Please update the pod, too.
+our $VERSION = '1.57'; # Please update the pod, too.
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
@@ -195,7 +195,7 @@ threads::shared - Perl extension for sharing data structures between threads
=head1 VERSION
-This document describes threads::shared version 1.56
+This document describes threads::shared version 1.57
=head1 SYNOPSIS
diff --git a/dist/threads-shared/shared.xs b/dist/threads-shared/shared.xs
index 3c1b5e608c..40207aa88b 100644
--- a/dist/threads-shared/shared.xs
+++ b/dist/threads-shared/shared.xs
@@ -656,14 +656,15 @@ Perl_sharedsv_cond_timedwait(perl_cond *cond, perl_mutex *mut, double abs)
abs -= (NV)ts.tv_sec;
ts.tv_nsec = (long)(abs * 1000000000.0);
-#if defined(__clang__) || defined(__clang)
+#if defined(CLANG_DIAG_IGNORE)
CLANG_DIAG_IGNORE(-Wthread-safety);
/* warning: calling function 'pthread_cond_timedwait' requires holding mutex 'mut' exclusively [-Wthread-safety-analysis] */
#endif
switch (pthread_cond_timedwait(cond, mut, &ts)) {
-#if defined(__clang__) || defined(__clang)
+/* perl.h defines CLANG_DIAG_* but only in 5.24+ */
+#if defined(CLANG_DIAG_RESTORE)
CLANG_DIAG_RESTORE;
#endif
--
2.11.0
|
The RT System itself - Status changed from 'new' to 'open' |
From @jkeenanOn Sun, 07 May 2017 22:51:02 GMT, jdhedden@gmail.com wrote:
Thanks, applied to blead in commit 7ce27a6. Marking ticket Resolved. -- |
@jkeenan - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#131268 (status was 'resolved')
Searchable as RT131268$
The text was updated successfully, but these errors were encountered: